1 | /* $Id: controls.cpp,v 1.10 2000-02-16 14:34:08 sandervl Exp $ */
|
---|
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 "combo.h" //listbox,combo,edit
|
---|
16 | #include "win32wmdiclient.h"
|
---|
17 | #include "win32dlg.h"
|
---|
18 | #include "win32wdesktop.h"
|
---|
19 | #include "winswitch.h"
|
---|
20 | #include "icontitle.h"
|
---|
21 | #include "menu.h"
|
---|
22 | #include "controls.h"
|
---|
23 |
|
---|
24 | #define DBG_LOCALLOG DBG_controls
|
---|
25 | #include "dbglocal.h"
|
---|
26 |
|
---|
27 | ATOM controlAtoms[MAX_CONTROLS] = {0};
|
---|
28 |
|
---|
29 | /* registration */
|
---|
30 |
|
---|
31 | void CONTROLS_Register()
|
---|
32 | {
|
---|
33 | dprintf(("Register DESKTOP class"));
|
---|
34 | controlAtoms[DESKTOP_CONTROL] = DESKTOP_Register();
|
---|
35 | if (!controlAtoms[DESKTOP_CONTROL]) dprintf(("failed!!!"));
|
---|
36 |
|
---|
37 | //SvL: Create Desktop Window
|
---|
38 | CreateWin32Desktop();
|
---|
39 |
|
---|
40 | dprintf(("Register BUTTON class"));
|
---|
41 | controlAtoms[BUTTON_CONTROL] = BUTTON_Register();
|
---|
42 | if (!controlAtoms[BUTTON_CONTROL]) dprintf(("failed!!!"));
|
---|
43 |
|
---|
44 | dprintf(("Register STATIC class"));
|
---|
45 | controlAtoms[STATIC_CONTROL] = STATIC_Register();
|
---|
46 | if (!controlAtoms[STATIC_CONTROL]) dprintf(("failed!!!"));
|
---|
47 |
|
---|
48 | dprintf(("Register SCROLLBAR class"));
|
---|
49 | controlAtoms[SCROLLBAR_CONTROL] = SCROLLBAR_Register();
|
---|
50 | if (!controlAtoms[SCROLLBAR_CONTROL]) dprintf(("failed!!!"));
|
---|
51 |
|
---|
52 | dprintf(("Register LISTBOX class"));
|
---|
53 | controlAtoms[LISTBOX_CONTROL] = LISTBOX_Register();
|
---|
54 | if (!controlAtoms[LISTBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
55 |
|
---|
56 | dprintf(("Register COMBOLBOX class"));
|
---|
57 | controlAtoms[COMBOLBOX_CONTROL] = COMBOLBOX_Register();
|
---|
58 | if (!controlAtoms[COMBOLBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
59 |
|
---|
60 | dprintf(("Register COMBOBOX class"));
|
---|
61 | controlAtoms[COMBOBOX_CONTROL] = COMBOBOX_Register();
|
---|
62 | if (!controlAtoms[COMBOBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
63 |
|
---|
64 | dprintf(("Register EDIT class"));
|
---|
65 | controlAtoms[EDIT_CONTROL] = EDIT_Register();
|
---|
66 | if (!controlAtoms[EDIT_CONTROL]) dprintf(("failed!!!"));
|
---|
67 |
|
---|
68 | dprintf(("Register MDICLIENT class"));
|
---|
69 | controlAtoms[MDICLIENT_CONTROL] = MDICLIENT_Register();
|
---|
70 | if (!controlAtoms[MDICLIENT_CONTROL]) dprintf(("failed!!!"));
|
---|
71 |
|
---|
72 | dprintf(("Register DIALOG class"));
|
---|
73 | controlAtoms[DIALOG_CONTROL] = DIALOG_Register();
|
---|
74 | if (!controlAtoms[DIALOG_CONTROL]) dprintf(("failed!!!"));
|
---|
75 |
|
---|
76 | dprintf(("Register WINSWITCH class"));
|
---|
77 | controlAtoms[WINSWITCH_CONTROL] = WINSWITCH_Register();
|
---|
78 | if (!controlAtoms[WINSWITCH_CONTROL]) dprintf(("failed!!!"));
|
---|
79 |
|
---|
80 | dprintf(("Register ICONTITLE class"));
|
---|
81 | controlAtoms[ICONTITLE_CONTROL] = ICONTITLE_Register();
|
---|
82 | if (!controlAtoms[ICONTITLE_CONTROL]) dprintf(("failed!!!"));
|
---|
83 |
|
---|
84 | dprintf(("Register POPUPMENU class"));
|
---|
85 | controlAtoms[POPUPMENU_CONTROL] = POPUPMENU_Register();
|
---|
86 | if (!controlAtoms[POPUPMENU_CONTROL]) dprintf(("failed!!!"));
|
---|
87 | }
|
---|
88 |
|
---|
89 | void CONTROLS_Unregister()
|
---|
90 | {
|
---|
91 | dprintf(("Unregister BUTTON class"));
|
---|
92 | if (!BUTTON_Unregister()) dprintf(("failed!!!"));
|
---|
93 |
|
---|
94 | dprintf(("Unregister STATIC class"));
|
---|
95 | if (!STATIC_Unregister()) dprintf(("failed!!!"));
|
---|
96 |
|
---|
97 | dprintf(("Unregister SCROLLBAR class"));
|
---|
98 | if (!SCROLLBAR_Unregister()) dprintf(("failed!!!"));
|
---|
99 |
|
---|
100 | dprintf(("Unregister LISTBOX class"));
|
---|
101 | if (!LISTBOX_Unregister()) dprintf(("failed!!!"));
|
---|
102 |
|
---|
103 | dprintf(("Unregister COMBOLBOX class"));
|
---|
104 | if (!COMBOLBOX_Unregister()) dprintf(("failed!!!"));
|
---|
105 |
|
---|
106 | dprintf(("Unregister COMBOBOX class"));
|
---|
107 | if (!COMBOBOX_Unregister()) dprintf(("failed!!!"));
|
---|
108 |
|
---|
109 | dprintf(("Unregister EDIT class"));
|
---|
110 | if (!EDIT_Unregister()) dprintf(("failed!!!"));
|
---|
111 |
|
---|
112 | dprintf(("Unregister MDICLIENT class"));
|
---|
113 | if (!MDICLIENT_Unregister()) dprintf(("failed!!!"));
|
---|
114 |
|
---|
115 | dprintf(("Unregister DIALOG class"));
|
---|
116 | if (!DIALOG_Unregister()) dprintf(("failed!!!"));
|
---|
117 |
|
---|
118 | dprintf(("Unregister DESKTOP class"));
|
---|
119 | if (!DESKTOP_Unregister()) dprintf(("failed!!!"));
|
---|
120 |
|
---|
121 | dprintf(("Unregister WINSWITCH class"));
|
---|
122 | if (!WINSWITCH_Unregister()) dprintf(("failed!!!"));
|
---|
123 |
|
---|
124 | dprintf(("Unregister ICONTITLE class"));
|
---|
125 | if (!ICONTITLE_Unregister()) dprintf(("failed!!!"));
|
---|
126 |
|
---|
127 | dprintf(("Unregister POPUPMENU class"));
|
---|
128 | if (!POPUPMENU_Unregister()) dprintf(("failed!!!"));
|
---|
129 |
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|
133 | BOOL CONTROLS_IsControl(Win32BaseWindow *window, int control)
|
---|
134 | {
|
---|
135 | if(control >= MAX_CONTROLS || window == NULL || window->getClass() == NULL)
|
---|
136 | return FALSE;
|
---|
137 |
|
---|
138 | return controlAtoms[control] == window->getClass()->getAtom();
|
---|
139 | }
|
---|
140 |
|
---|