[9598] | 1 | /* $Id: controls.cpp,v 1.12 2003-01-03 16:35:51 sandervl Exp $ */
|
---|
[2469] | 2 | /* File: controls.cpp -- Win32 common controls
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999 Christoph Bratschi
|
---|
| 5 | *
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include <os2win.h>
|
---|
| 9 | #include <string.h>
|
---|
| 10 | #include "misc.h"
|
---|
| 11 |
|
---|
| 12 | #include "button.h"
|
---|
| 13 | #include "static.h"
|
---|
| 14 | #include "scroll.h"
|
---|
| 15 | #include "win32wmdiclient.h"
|
---|
| 16 | #include "win32dlg.h"
|
---|
| 17 | #include "win32wdesktop.h"
|
---|
[9523] | 18 | #include "win32class.h"
|
---|
[2469] | 19 | #include "winswitch.h"
|
---|
| 20 | #include "icontitle.h"
|
---|
| 21 | #include "menu.h"
|
---|
| 22 | #include "controls.h"
|
---|
[9523] | 23 | #include "ctrlconf.h"
|
---|
[2469] | 24 |
|
---|
[2804] | 25 | #define DBG_LOCALLOG DBG_controls
|
---|
| 26 | #include "dbglocal.h"
|
---|
| 27 |
|
---|
[2469] | 28 | ATOM controlAtoms[MAX_CONTROLS] = {0};
|
---|
| 29 |
|
---|
| 30 | /* registration */
|
---|
| 31 |
|
---|
| 32 | void CONTROLS_Register()
|
---|
| 33 | {
|
---|
[2582] | 34 | dprintf(("Register DESKTOP class"));
|
---|
| 35 | controlAtoms[DESKTOP_CONTROL] = DESKTOP_Register();
|
---|
| 36 | if (!controlAtoms[DESKTOP_CONTROL]) dprintf(("failed!!!"));
|
---|
| 37 |
|
---|
| 38 | //SvL: Create Desktop Window
|
---|
| 39 | CreateWin32Desktop();
|
---|
| 40 |
|
---|
[2469] | 41 | dprintf(("Register BUTTON class"));
|
---|
| 42 | controlAtoms[BUTTON_CONTROL] = BUTTON_Register();
|
---|
| 43 | if (!controlAtoms[BUTTON_CONTROL]) dprintf(("failed!!!"));
|
---|
| 44 |
|
---|
| 45 | dprintf(("Register STATIC class"));
|
---|
| 46 | controlAtoms[STATIC_CONTROL] = STATIC_Register();
|
---|
| 47 | if (!controlAtoms[STATIC_CONTROL]) dprintf(("failed!!!"));
|
---|
| 48 |
|
---|
| 49 | dprintf(("Register SCROLLBAR class"));
|
---|
[9598] | 50 | controlAtoms[SCROLLBAR_CONTROL] =
|
---|
| 51 | #if 0
|
---|
| 52 | InternalRegisterClass((LPSTR)SCROLL_builtin_class.name,
|
---|
| 53 | SCROLL_builtin_class.style,
|
---|
| 54 | SCROLL_builtin_class.procA,
|
---|
| 55 | SCROLL_builtin_class.procW,
|
---|
| 56 | SCROLL_builtin_class.extra,
|
---|
| 57 | SCROLL_builtin_class.cursor,
|
---|
| 58 | SCROLL_builtin_class.brush);
|
---|
| 59 | #else
|
---|
| 60 | SCROLLBAR_Register();
|
---|
| 61 | #endif
|
---|
[2469] | 62 | if (!controlAtoms[SCROLLBAR_CONTROL]) dprintf(("failed!!!"));
|
---|
| 63 |
|
---|
| 64 | dprintf(("Register LISTBOX class"));
|
---|
[9523] | 65 | controlAtoms[LISTBOX_CONTROL] =
|
---|
| 66 | InternalRegisterClass((LPSTR)LISTBOX_builtin_class.name,
|
---|
| 67 | LISTBOX_builtin_class.style,
|
---|
| 68 | LISTBOX_builtin_class.procA,
|
---|
| 69 | LISTBOX_builtin_class.procW,
|
---|
| 70 | LISTBOX_builtin_class.extra,
|
---|
| 71 | LISTBOX_builtin_class.cursor,
|
---|
| 72 | LISTBOX_builtin_class.brush);
|
---|
| 73 |
|
---|
[2469] | 74 | if (!controlAtoms[LISTBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
| 75 |
|
---|
| 76 | dprintf(("Register COMBOLBOX class"));
|
---|
[9523] | 77 | controlAtoms[COMBOLBOX_CONTROL] =
|
---|
| 78 | InternalRegisterClass((LPSTR)COMBOLBOX_builtin_class.name,
|
---|
| 79 | COMBOLBOX_builtin_class.style,
|
---|
| 80 | COMBOLBOX_builtin_class.procA,
|
---|
| 81 | COMBOLBOX_builtin_class.procW,
|
---|
| 82 | COMBOLBOX_builtin_class.extra,
|
---|
| 83 | COMBOLBOX_builtin_class.cursor,
|
---|
| 84 | COMBOLBOX_builtin_class.brush);
|
---|
[2469] | 85 | if (!controlAtoms[COMBOLBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
| 86 |
|
---|
| 87 | dprintf(("Register COMBOBOX class"));
|
---|
[9523] | 88 | controlAtoms[COMBOBOX_CONTROL] =
|
---|
| 89 | InternalRegisterClass((LPSTR)COMBO_builtin_class.name,
|
---|
| 90 | COMBO_builtin_class.style,
|
---|
| 91 | COMBO_builtin_class.procA,
|
---|
| 92 | COMBO_builtin_class.procW,
|
---|
| 93 | COMBO_builtin_class.extra,
|
---|
| 94 | COMBO_builtin_class.cursor,
|
---|
| 95 | COMBO_builtin_class.brush);
|
---|
[2469] | 96 | if (!controlAtoms[COMBOBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
| 97 |
|
---|
| 98 | dprintf(("Register EDIT class"));
|
---|
[9523] | 99 | controlAtoms[EDIT_CONTROL] =
|
---|
| 100 | InternalRegisterClass((LPSTR)EDIT_builtin_class.name,
|
---|
| 101 | EDIT_builtin_class.style,
|
---|
| 102 | EDIT_builtin_class.procA,
|
---|
| 103 | EDIT_builtin_class.procW,
|
---|
| 104 | EDIT_builtin_class.extra,
|
---|
| 105 | EDIT_builtin_class.cursor,
|
---|
| 106 | EDIT_builtin_class.brush);
|
---|
[2469] | 107 | if (!controlAtoms[EDIT_CONTROL]) dprintf(("failed!!!"));
|
---|
| 108 |
|
---|
| 109 | dprintf(("Register MDICLIENT class"));
|
---|
[9523] | 110 | controlAtoms[MDICLIENT_CONTROL] =
|
---|
| 111 | InternalRegisterClass((LPSTR)MDICLIENT_builtin_class.name,
|
---|
| 112 | MDICLIENT_builtin_class.style,
|
---|
| 113 | MDICLIENT_builtin_class.procA,
|
---|
| 114 | MDICLIENT_builtin_class.procW,
|
---|
| 115 | MDICLIENT_builtin_class.extra,
|
---|
| 116 | MDICLIENT_builtin_class.cursor,
|
---|
| 117 | //Default brush is ugly light gray; use this one instead
|
---|
| 118 | GetStockObject(GRAY_BRUSH));
|
---|
| 119 | // MDICLIENT_builtin_class.brush);
|
---|
[2469] | 120 | if (!controlAtoms[MDICLIENT_CONTROL]) dprintf(("failed!!!"));
|
---|
| 121 |
|
---|
| 122 | dprintf(("Register DIALOG class"));
|
---|
| 123 | controlAtoms[DIALOG_CONTROL] = DIALOG_Register();
|
---|
| 124 | if (!controlAtoms[DIALOG_CONTROL]) dprintf(("failed!!!"));
|
---|
| 125 |
|
---|
| 126 | dprintf(("Register WINSWITCH class"));
|
---|
| 127 | controlAtoms[WINSWITCH_CONTROL] = WINSWITCH_Register();
|
---|
| 128 | if (!controlAtoms[WINSWITCH_CONTROL]) dprintf(("failed!!!"));
|
---|
| 129 |
|
---|
| 130 | dprintf(("Register ICONTITLE class"));
|
---|
| 131 | controlAtoms[ICONTITLE_CONTROL] = ICONTITLE_Register();
|
---|
| 132 | if (!controlAtoms[ICONTITLE_CONTROL]) dprintf(("failed!!!"));
|
---|
| 133 |
|
---|
| 134 | dprintf(("Register POPUPMENU class"));
|
---|
[9598] | 135 | controlAtoms[POPUPMENU_CONTROL] =
|
---|
| 136 | InternalRegisterClass((LPSTR)MENU_builtin_class.name,
|
---|
| 137 | MENU_builtin_class.style,
|
---|
| 138 | MENU_builtin_class.procA,
|
---|
| 139 | MENU_builtin_class.procW,
|
---|
| 140 | MENU_builtin_class.extra,
|
---|
| 141 | MENU_builtin_class.cursor,
|
---|
| 142 | MENU_builtin_class.brush);
|
---|
[2469] | 143 | if (!controlAtoms[POPUPMENU_CONTROL]) dprintf(("failed!!!"));
|
---|
[9598] | 144 | MENU_Init();
|
---|
[2469] | 145 | }
|
---|
| 146 |
|
---|
| 147 | void CONTROLS_Unregister()
|
---|
| 148 | {
|
---|
| 149 | dprintf(("Unregister BUTTON class"));
|
---|
| 150 | if (!BUTTON_Unregister()) dprintf(("failed!!!"));
|
---|
| 151 |
|
---|
| 152 | dprintf(("Unregister STATIC class"));
|
---|
| 153 | if (!STATIC_Unregister()) dprintf(("failed!!!"));
|
---|
| 154 |
|
---|
| 155 | dprintf(("Unregister SCROLLBAR class"));
|
---|
[9598] | 156 | #if 0
|
---|
| 157 | if (!UnregisterClassA((LPSTR)SCROLL_builtin_class.name, NULL)) dprintf(("failed!!!"));
|
---|
| 158 | #else
|
---|
[2469] | 159 | if (!SCROLLBAR_Unregister()) dprintf(("failed!!!"));
|
---|
[9598] | 160 | #endif
|
---|
[2469] | 161 |
|
---|
| 162 | dprintf(("Unregister LISTBOX class"));
|
---|
[9523] | 163 | if (!UnregisterClassA((LPSTR)LISTBOX_builtin_class.name, NULL)) dprintf(("failed!!!"));
|
---|
[2469] | 164 |
|
---|
| 165 | dprintf(("Unregister COMBOLBOX class"));
|
---|
[9523] | 166 | if (!UnregisterClassA((LPSTR)COMBOLBOX_builtin_class.name, NULL)) dprintf(("failed!!!"));
|
---|
[2469] | 167 |
|
---|
| 168 | dprintf(("Unregister COMBOBOX class"));
|
---|
[9523] | 169 | if (!UnregisterClassA((LPSTR)COMBO_builtin_class.name, NULL)) dprintf(("failed!!!"));
|
---|
[2469] | 170 |
|
---|
| 171 | dprintf(("Unregister EDIT class"));
|
---|
[9523] | 172 | if (!UnregisterClassA((LPSTR)EDIT_builtin_class.name, NULL)) dprintf(("failed!!!"));
|
---|
[2469] | 173 |
|
---|
| 174 | dprintf(("Unregister MDICLIENT class"));
|
---|
[9523] | 175 | if (!UnregisterClassA((LPSTR)MDICLIENT_builtin_class.name, NULL)) dprintf(("failed!!!"));
|
---|
[2469] | 176 |
|
---|
| 177 | dprintf(("Unregister DIALOG class"));
|
---|
| 178 | if (!DIALOG_Unregister()) dprintf(("failed!!!"));
|
---|
| 179 |
|
---|
| 180 | dprintf(("Unregister DESKTOP class"));
|
---|
| 181 | if (!DESKTOP_Unregister()) dprintf(("failed!!!"));
|
---|
| 182 |
|
---|
| 183 | dprintf(("Unregister WINSWITCH class"));
|
---|
| 184 | if (!WINSWITCH_Unregister()) dprintf(("failed!!!"));
|
---|
| 185 |
|
---|
| 186 | dprintf(("Unregister ICONTITLE class"));
|
---|
| 187 | if (!ICONTITLE_Unregister()) dprintf(("failed!!!"));
|
---|
| 188 |
|
---|
| 189 | dprintf(("Unregister POPUPMENU class"));
|
---|
[9598] | 190 | if (!UnregisterClassA((LPSTR)MENU_builtin_class.name, NULL)) dprintf(("failed!!!"));
|
---|
[2469] | 191 | }
|
---|
| 192 |
|
---|
| 193 |
|
---|
| 194 | BOOL CONTROLS_IsControl(Win32BaseWindow *window, int control)
|
---|
| 195 | {
|
---|
| 196 | if(control >= MAX_CONTROLS || window == NULL || window->getClass() == NULL)
|
---|
| 197 | return FALSE;
|
---|
| 198 |
|
---|
| 199 | return controlAtoms[control] == window->getClass()->getAtom();
|
---|
| 200 | }
|
---|
| 201 |
|
---|