xref: /reactos/base/applications/osk/precomp.h (revision 9d33a205)
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     /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
61     HWND       hActiveWnd;
62 
63     /* On-Screen Keyboard registry settings */
64     BOOL       bShowWarning;
65     BOOL       bIsEnhancedKeyboard;
66     BOOL       bSoundClick;
67     BOOL       bAlwaysOnTop;
68     INT        PosX;
69     INT        PosY;
70     WCHAR      FontFaceName[LF_FACESIZE];
71     LONG       FontHeight;
72 } OSK_GLOBALS;
73 
74 typedef struct
75 {
76     INT vKey;
77     INT DlgResource;
78     WORD wScanCode;
79     BOOL bWasKeyPressed;
80 } OSK_KEYLEDINDICATOR;
81 
82 /* PROTOTYPES *****************************************************************/
83 
84 /* keyboard.c */
85 extern KEYBOARD_STRUCT StandardKeyboard;
86 extern KEYBOARD_STRUCT EnhancedKeyboard;
87 
88 /* main.c */
89 int OSK_SetImage(int IdDlgItem, int IdResource);
90 LRESULT OSK_Create(HWND hwnd);
91 int OSK_Close(void);
92 int OSK_Timer(void);
93 BOOL OSK_Command(WPARAM wCommand, HWND hWndControl);
94 BOOL OSK_ReleaseKey(WORD ScanCode);
95 LRESULT APIENTRY OSK_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
96 DWORD WINAPI OSK_WarningDlgThread(LPVOID lpParameter);
97 int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
98 VOID OSK_RestoreDlgPlacement(HWND hDlg);
99 VOID OSK_RefreshLEDKeys(VOID);
100 INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
101 
102 /* settings.c */
103 LONG LoadDWORDFromRegistry(IN LPCWSTR lpValueDataName,
104                            OUT PDWORD pdwValueData);
105 
106 LONG LoadStringFromRegistry(IN LPCWSTR lpValueDataName,
107                             OUT LPWSTR lpValueData,
108                             IN OUT LPUINT cchCount);
109 
110 LONG SaveDWORDToRegistry(IN LPCWSTR lpValueDataName,
111                          IN DWORD dwValueData);
112 
113 LONG SaveStringToRegistry(IN LPCWSTR lpValueDataName,
114                           IN LPCWSTR lpValueData,
115                           IN UINT cchCount);
116 
117 VOID LoadSettings(VOID);
118 VOID SaveSettings(VOID);
119 
120 /* DEFINES ********************************************************************/
121 
122 #define SCANCODE_MASK 0xFF
123 
124 extern OSK_GLOBALS Globals;
125 
126 #define OSK_CLASS L"OSKMainWindow"
127 #define DEFAULT_FONTSIZE 15
128 
129 /* OSK_SetKeys reasons */
130 enum SetKeys_Reason
131 {
132     SETKEYS_INIT,
133     SETKEYS_LAYOUT,
134     SETKEYS_LANG
135 };
136 
137 #endif /* _OSK_PRECOMP_H */
138 
139 /* EOF */
140