Ember
Loading...
Searching...
No Matches
DPI.h
Go to the documentation of this file.
1#pragma once
2
3#include <wx/display.h>
4#include <wx/window.h>
5
6namespace EmberUI {
8namespace DPI {
9
11inline int Scale(wxWindow *win, int px) { return win->FromDIP(px); }
13inline wxSize Scale(wxWindow *win, const wxSize &size) { return win->FromDIP(size); }
14
16inline wxSize GetScreenSize() {
17 int w, h;
18 wxDisplaySize(&w, &h);
19 return wxSize(w, h);
20}
21
23inline wxSize GetScreenSize(wxWindow *win) {
24 int idx = wxDisplay::GetFromWindow(win);
25 if (idx == wxNOT_FOUND)
26 idx = 0;
27 return wxDisplay(idx).GetGeometry().GetSize();
28}
29
30} // namespace DPI
31} // namespace EmberUI
DPI scaling and screen size utilities for wxWidgets windows.
Definition DPI.h:8
wxSize GetScreenSize()
Returns the primary display size in pixels.
Definition DPI.h:16
int Scale(wxWindow *win, int px)
Scales a pixel value from logical to physical units for the given window.
Definition DPI.h:11
Definition Panel.h:8