|
13 | 13 | namespace BrokenBytes::DualSense4Windows::UI { |
14 | 14 | constexpr LPCWSTR WINDOW_DEFAULT = L"WINDOW_DEFAULT"; |
15 | 15 |
|
| 16 | + constexpr int FONT_TAB = 19; |
| 17 | + constexpr int FONT_HEADLINE = 23; |
| 18 | + constexpr int FONT_LABEL = 21; |
| 19 | + constexpr int FONT_BTN = 22; |
| 20 | + |
16 | 21 | class Window { |
17 | 22 | public: |
18 | 23 | Window( |
@@ -44,8 +49,8 @@ namespace BrokenBytes::DualSense4Windows::UI { |
44 | 49 | GetModuleHandle(nullptr), |
45 | 50 | nullptr |
46 | 51 | ); |
47 | | - SendMessageW(_handle, WM_THEMECHANGED, 0, 0); |
48 | 52 | SetWindowLongPtr(_handle, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); |
| 53 | + SetFont(Handle(), FONT_HEADLINE); |
49 | 54 |
|
50 | 55 | if (_handle == nullptr) { |
51 | 56 | return; |
@@ -155,6 +160,23 @@ namespace BrokenBytes::DualSense4Windows::UI { |
155 | 160 | _isRegistered = true; |
156 | 161 | } |
157 | 162 |
|
| 163 | + /// <summary> |
| 164 | + /// Sets the default font for the given window |
| 165 | + /// </summary> |
| 166 | + /// <param name="handle"></param> |
| 167 | + void SetFont(HWND handle, int size) { |
| 168 | + HFONT hFont = CreateFont(size, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, |
| 169 | + OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, HIGH_LEVEL, |
| 170 | + DEFAULT_PITCH | FF_DONTCARE, TEXT("Roboto")); |
| 171 | + SendMessage( |
| 172 | + handle, |
| 173 | + WM_SETFONT, |
| 174 | + reinterpret_cast<WPARAM>(hFont), |
| 175 | + true |
| 176 | + ); |
| 177 | + } |
| 178 | + |
| 179 | + |
158 | 180 | /// <summary> |
159 | 181 | /// Sets the handle of this Window |
160 | 182 | /// </summary> |
|
0 commit comments