xref: /reactos/base/applications/osk/precomp.h (revision 47f3a4e1)
1 /*
2  * PROJECT:         ReactOS On-Screen Keyboard
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Pre-compiled header
5  * COPYRIGHT:       Denis ROBERT
6  *                  Copyright 2019 George Bișoc (george.bisoc@reactos.org)
7  */
8 
9 #ifndef _OSK_PRECOMP_H
10 #define _OSK_PRECOMP_H
11 
12 /* INCLUDES *******************************************************************/
13 
14 #include <stdio.h>
15 
16 #include <windows.h>
17 #include <debug.h>
18 #include "commctrl.h"
19 #include "strsafe.h"
20 
21 #include "osk_res.h"
22 
23 /* TYPES **********************************************************************/
24 
25 typedef struct _KEY
26 {
27     LPCWSTR name;
28     INT_PTR scancode;
29     INT x;
30     INT y;
31     INT cx;
32     INT cy;
33     INT flags;
34     BOOL translate;
35 } KEY, *PKEY;
36 
37 typedef struct _KEYBOARD_STRUCT
38 {
39     PKEY Keys;
40     INT KeyCount;
41     SIZE Size;
42     POINT LedTextStart;
43     SIZE LedTextSize;
44     INT LedTextOffset;
45     POINT LedStart;
46     SIZE LedSize;
47     INT LedGap;
48 } KEYBOARD_STRUCT, *PKEYBOARD_STRUCT;
49 
50 typedef struct
51 {
52     HINSTANCE  hInstance;
53     HWND       hMainWnd;
54     HBRUSH     hBrushGreenLed;
55     UINT_PTR   iTimer;
56     PKEYBOARD_STRUCT Keyboard;
57     HWND*      hKeys;
58     HFONT      hFont;
59     WCHAR      szTitle[MAX_PATH];
60 
61     /* On-Screen Keyboard registry settings */
62     BOOL       bShowWarning;
63     BOOL       bIsEnhancedKeyboard;
64     BOOL       bSoundClick;
65     BOOL       bAlwaysOnTop;
66     INT        PosX;
67     INT        PosY;
68     WCHAR      FontFaceName[LF_FACESIZE];
69     LONG       FontHeight;
70 } OSK_GLOBALS;
71 
72 typedef struct
73 {
74     INT vKey;
75     INT DlgResource;
76     WORD wScanCode;
77     BOOL bWasKeyPressed;
78 } OSK_KEYLEDINDICATOR;
79 
80 /* PROTOTYPES *****************************************************************/
81 
82 /* keyboard.c */
83 extern KEYBOARD_STRUCT StandardKeyboard;
84 extern KEYBOARD_STRUCT EnhancedKeyboard;
85 
86 /* main.c */
87 int OSK_SetImage(int IdDlgItem, int IdResource);
88 LRESULT OSK_Create(HWND hwnd);
89 int OSK_Close(void);
90 int OSK_Timer(void);
91 BOOL OSK_Command(WPARAM wCommand, HWND hWndControl);
92 BOOL OSK_ReleaseKey(WORD ScanCode);
93 LRESULT APIENTRY OSK_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
94 DWORD WINAPI OSK_WarningDlgThread(LPVOID lpParameter);
95 int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
96 VOID OSK_RestoreDlgPlacement(HWND hDlg);
97 VOID OSK_RefreshLEDKeys(VOID);
98 INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
99 
100 /* settings.c */
101 LONG LoadDWORDFromRegistry(IN LPCWSTR lpValueDataName,
102                            OUT PDWORD pdwValueData);
103 
104 LONG LoadStringFromRegistry(IN LPCWSTR lpValueDataName,
105                             OUT LPWSTR lpValueData,
106                             IN OUT LPUINT cchCount);
107 
108 LONG SaveDWORDToRegistry(IN LPCWSTR lpValueDataName,
109                          IN DWORD dwValueData);
110 
111 LONG SaveStringToRegistry(IN LPCWSTR lpValueDataName,
112                           IN LPCWSTR lpValueData,
113                           IN UINT cchCount);
114 
115 VOID LoadSettings(VOID);
116 VOID SaveSettings(VOID);
117 
118 /* DEFINES ********************************************************************/
119 
120 #define SCANCODE_MASK 0xFF
121 
122 extern OSK_GLOBALS Globals;
123 
124 #define OSK_CLASS L"OSKMainWindow"
125 #define DEFAULT_FONTSIZE 15
126 
127 /* OSK_SetKeys reasons */
128 enum SetKeys_Reason
129 {
130     SETKEYS_INIT,
131     SETKEYS_LAYOUT,
132     SETKEYS_LANG
133 };
134 
135 #endif /* _OSK_PRECOMP_H */
136 
137 /* EOF */
138