ui/win32/toolkit.c

changeset 817
d09817e6e6a4
parent 816
f5690594b240
child 880
9c99ff36513f
equal deleted inserted replaced
816:f5690594b240 817:d09817e6e6a4
50 static ui_callback open_func; 50 static ui_callback open_func;
51 void *open_data; 51 void *open_data;
52 static ui_callback exit_func; 52 static ui_callback exit_func;
53 void *exit_data; 53 void *exit_data;
54 54
55 static HFONT ui_font = NULL;
56
55 void ui_init(const char *appname, int argc, char **argv) { 57 void ui_init(const char *appname, int argc, char **argv) {
56 application_name = appname; 58 application_name = appname;
57 59
58 uic_init_global_context(); 60 uic_init_global_context();
59 uic_menu_init(); 61 uic_menu_init();
64 66
65 INITCOMMONCONTROLSEX icex = { sizeof(icex), ICC_WIN95_CLASSES }; 67 INITCOMMONCONTROLSEX icex = { sizeof(icex), ICC_WIN95_CLASSES };
66 InitCommonControlsEx(&icex); 68 InitCommonControlsEx(&icex);
67 69
68 SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); 70 SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
71
72 NONCLIENTMETRICS ncm = { sizeof(ncm) };
73 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE);
74 ui_font = CreateFontIndirect(&ncm.lfMessageFont);
75 }
76
77 HFONT ui_win32_get_font(void) {
78 return ui_font;
79 }
80
81 void ui_win32_set_ui_font(HWND control) {
82 if (ui_font) {
83 SendMessage(control, WM_SETFONT, (WPARAM)ui_font, TRUE);
84 }
69 } 85 }
70 86
71 const char* ui_appname() { 87 const char* ui_appname() {
72 return application_name; 88 return application_name;
73 } 89 }

mercurial