1 | /* $Id: controls.cpp,v 1.13 2000-01-01 14:57:10 cbratschi 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 "controls.h"
|
---|
22 |
|
---|
23 | ATOM controlAtoms[MAX_CONTROLS] = {0};
|
---|
24 |
|
---|
25 | /* registration */
|
---|
26 |
|
---|
27 | void CONTROLS_Register()
|
---|
28 | {
|
---|
29 | dprintf(("Register BUTTON class"));
|
---|
30 | controlAtoms[BUTTON_CONTROL] = BUTTON_Register();
|
---|
31 | if (!controlAtoms[BUTTON_CONTROL]) dprintf(("failed!!!"));
|
---|
32 |
|
---|
33 | dprintf(("Register STATIC class"));
|
---|
34 | controlAtoms[STATIC_CONTROL] = STATIC_Register();
|
---|
35 | if (!controlAtoms[STATIC_CONTROL]) dprintf(("failed!!!"));
|
---|
36 |
|
---|
37 | dprintf(("Register SCROLLBAR class"));
|
---|
38 | controlAtoms[SCROLLBAR_CONTROL] = SCROLLBAR_Register();
|
---|
39 | if (!controlAtoms[SCROLLBAR_CONTROL]) dprintf(("failed!!!"));
|
---|
40 |
|
---|
41 | dprintf(("Register LISTBOX class"));
|
---|
42 | controlAtoms[LISTBOX_CONTROL] = LISTBOX_Register();
|
---|
43 | if (!controlAtoms[LISTBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
44 |
|
---|
45 | dprintf(("Register COMBOLBOX class"));
|
---|
46 | controlAtoms[COMBOLBOX_CONTROL] = COMBOLBOX_Register();
|
---|
47 | if (!controlAtoms[COMBOLBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
48 |
|
---|
49 | dprintf(("Register COMBOBOX class"));
|
---|
50 | controlAtoms[COMBOBOX_CONTROL] = COMBOBOX_Register();
|
---|
51 | if (!controlAtoms[COMBOBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
52 |
|
---|
53 | dprintf(("Register EDIT class"));
|
---|
54 | controlAtoms[EDIT_CONTROL] = EDIT_Register();
|
---|
55 | if (!controlAtoms[EDIT_CONTROL]) dprintf(("failed!!!"));
|
---|
56 |
|
---|
57 | dprintf(("Register MDICLIENT class"));
|
---|
58 | controlAtoms[MDICLIENT_CONTROL] = MDICLIENT_Register();
|
---|
59 | if (!controlAtoms[MDICLIENT_CONTROL]) dprintf(("failed!!!"));
|
---|
60 |
|
---|
61 | dprintf(("Register DIALOG class"));
|
---|
62 | controlAtoms[DIALOG_CONTROL] = DIALOG_Register();
|
---|
63 | if (!controlAtoms[DIALOG_CONTROL]) dprintf(("failed!!!"));
|
---|
64 |
|
---|
65 | dprintf(("Register DESKTOP class"));
|
---|
66 | controlAtoms[DESKTOP_CONTROL] = DESKTOP_Register();
|
---|
67 | if (!controlAtoms[DESKTOP_CONTROL]) dprintf(("failed!!!"));
|
---|
68 |
|
---|
69 | dprintf(("Register WINSWITCH class"));
|
---|
70 | controlAtoms[WINSWITCH_CONTROL] = WINSWITCH_Register();
|
---|
71 | if (!controlAtoms[WINSWITCH_CONTROL]) dprintf(("failed!!!"));
|
---|
72 |
|
---|
73 | dprintf(("Register ICONTITLE class"));
|
---|
74 | controlAtoms[ICONTITLE_CONTROL] = ICONTITLE_Register();
|
---|
75 | if (!controlAtoms[ICONTITLE_CONTROL]) dprintf(("failed!!!"));
|
---|
76 | }
|
---|
77 |
|
---|
78 | void CONTROLS_Unregister()
|
---|
79 | {
|
---|
80 | dprintf(("Unregister BUTTON class"));
|
---|
81 | if (!BUTTON_Unregister()) dprintf(("failed!!!"));
|
---|
82 |
|
---|
83 | dprintf(("Unregister STATIC class"));
|
---|
84 | if (!STATIC_Unregister()) dprintf(("failed!!!"));
|
---|
85 |
|
---|
86 | dprintf(("Unregister SCROLLBAR class"));
|
---|
87 | if (!SCROLLBAR_Unregister()) dprintf(("failed!!!"));
|
---|
88 |
|
---|
89 | dprintf(("Unregister LISTBOX class"));
|
---|
90 | if (!LISTBOX_Unregister()) dprintf(("failed!!!"));
|
---|
91 |
|
---|
92 | dprintf(("Unregister COMBOLBOX class"));
|
---|
93 | if (!COMBOLBOX_Unregister()) dprintf(("failed!!!"));
|
---|
94 |
|
---|
95 | dprintf(("Unregister COMBOBOX class"));
|
---|
96 | if (!COMBOBOX_Unregister()) dprintf(("failed!!!"));
|
---|
97 |
|
---|
98 | dprintf(("Unregister EDIT class"));
|
---|
99 | if (!EDIT_Unregister()) dprintf(("failed!!!"));
|
---|
100 |
|
---|
101 | dprintf(("Unregister MDICLIENT class"));
|
---|
102 | if (!MDICLIENT_Unregister()) dprintf(("failed!!!"));
|
---|
103 |
|
---|
104 | dprintf(("Unregister DIALOG class"));
|
---|
105 | if (!DIALOG_Unregister()) dprintf(("failed!!!"));
|
---|
106 |
|
---|
107 | dprintf(("Unregister DESKTOP class"));
|
---|
108 | if (!DESKTOP_Unregister()) dprintf(("failed!!!"));
|
---|
109 |
|
---|
110 | dprintf(("Unregister WINSWITCH class"));
|
---|
111 | if (!WINSWITCH_Unregister()) dprintf(("failed!!!"));
|
---|
112 |
|
---|
113 | dprintf(("Unregister ICONTITLE class"));
|
---|
114 | if (!ICONTITLE_Unregister()) dprintf(("failed!!!"));
|
---|
115 | }
|
---|
116 |
|
---|
117 |
|
---|
118 | BOOL WIDGETS_IsControl(Win32BaseWindow *window, int control)
|
---|
119 | {
|
---|
120 | if(control >= MAX_CONTROLS || window == NULL || window->getClass() == NULL)
|
---|
121 | return FALSE;
|
---|
122 |
|
---|
123 | return controlAtoms[control] == window->getClass()->getAtom();
|
---|
124 | }
|
---|
125 |
|
---|