[CONSRV] Cache the console window system menu handle; simplify its initialization...
[reactos.git] / win32ss / user / winsrv / consrv / frontends / gui / conwnd.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: win32ss/user/winsrv/consrv/frontends/gui/conwnd.h
5 * PURPOSE: GUI Console Window Class
6 * PROGRAMMERS: Gé van Geldorp
7 * Johannes Anderwald
8 * Jeffrey Morlan
9 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
10 */
11
12 #pragma once
13
14 /* GUI Console Window Class name */
15 #define GUI_CONWND_CLASS L"ConsoleWindowClass"
16
17 #ifndef WM_APP
18 #define WM_APP 0x8000
19 #endif
20 #define PM_RESIZE_TERMINAL (WM_APP + 3)
21 #define PM_CONSOLE_BEEP (WM_APP + 4)
22 #define PM_CONSOLE_SET_TITLE (WM_APP + 5)
23
24 /* Flags for GetKeyState */
25 #define KEY_TOGGLED 0x0001
26 #define KEY_PRESSED 0x8000
27
28 /*
29 typedef struct _CONSOLE_FONT
30 {
31 HFONT Font;
32 ULONG Flag;
33 } CONSOLE_FONT, *PCONSOLE_FONT;
34 */
35 #define FONT_NORMAL 0x00
36 #define FONT_BOLD 0x01
37 #define FONT_UNDERLINE 0x02
38 #define FONT_MAXNO 0x04
39
40 typedef struct _GUI_CONSOLE_DATA
41 {
42 CRITICAL_SECTION Lock;
43 BOOL WindowSizeLock;
44 HANDLE hGuiInitEvent;
45 HANDLE hGuiTermEvent;
46
47 // HANDLE InputThreadHandle;
48 ULONG_PTR InputThreadId;
49 HWINSTA WinSta;
50 HDESK Desktop;
51
52 BOOLEAN IsWindowVisible;
53
54 POINT OldCursor;
55
56 LONG_PTR WndStyle;
57 LONG_PTR WndStyleEx;
58 BOOL IsWndMax;
59 WINDOWPLACEMENT WndPl;
60
61 HWND hWindow; /* Handle to the console's window */
62 HDC hMemDC; /* Memory DC holding the console framebuffer */
63 HBITMAP hBitmap; /* Console framebuffer */
64 HPALETTE hSysPalette; /* Handle to the original system palette */
65
66 HICON hIcon; /* Handle to the console's icon (big) */
67 HICON hIconSm; /* Handle to the console's icon (small) */
68
69 /*** The following may be put per-screen-buffer !! ***/
70 HCURSOR hCursor; /* Handle to the mouse cursor */
71 INT MouseCursorRefCount; /* The reference counter associated with the mouse cursor. >= 0 and the cursor is shown; < 0 and the cursor is hidden. */
72 BOOL IgnoreNextMouseSignal; /* Used when we need to not process a mouse signal */
73
74 BOOL HackCORE8394IgnoreNextMove; /* HACK FOR CORE-8394. See conwnd.c!OnMouse for more details. */
75
76 HMENU hSysMenu; /* Handle to the console window system menu */
77 BOOL IsCloseButtonEnabled; /* TRUE if the Close button and the corresponding system menu item are enabled (default), FALSE otherwise */
78 UINT CmdIdLow ; /* Lowest menu id of the user-reserved menu id range */
79 UINT CmdIdHigh; /* Highest menu id of the user-reserved menu id range */
80
81 // COLORREF Colors[16];
82
83 // PVOID ScreenBuffer; /* Hardware screen buffer */
84
85 HFONT Font[FONT_MAXNO];
86 UINT CharWidth; /* The character width and height should be the same for */
87 UINT CharHeight; /* both normal and bold/underlined fonts... */
88 /*****************************************************/
89
90 PCONSRV_CONSOLE Console; /* Pointer to the owned console */
91 PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to the active screen buffer (then maybe the previous Console member is redundant?? Or not...) */
92 CONSOLE_SELECTION_INFO Selection; /* Contains information about the selection */
93 COORD dwSelectionCursor; /* Selection cursor position, most of the time different from Selection.dwSelectionAnchor */
94 BOOL LineSelection; /* TRUE if line-oriented selection (a la *nix terminals), FALSE if block-oriented selection (default on Windows) */
95
96 GUI_CONSOLE_INFO GuiInfo; /* GUI terminal settings */
97 } GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA;