1 | /* $Id: controls.cpp,v 1.4 1999-10-19 19:26:07 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 "controls.h"
|
---|
20 |
|
---|
21 | ATOM controlAtoms[MAX_CONTROLS] = {0};
|
---|
22 |
|
---|
23 | /* registration */
|
---|
24 |
|
---|
25 | void CONTROLS_Register()
|
---|
26 | {
|
---|
27 | //TODO: Remove this once we replace the atom code in kernel32
|
---|
28 | //Delete all Open32 global class atoms and recreate them
|
---|
29 | ATOM atom;
|
---|
30 |
|
---|
31 | atom = GlobalFindAtomA(BUTTONCLASSNAME);
|
---|
32 | if(atom) GlobalDeleteAtom(atom);
|
---|
33 | atom = GlobalFindAtomA(STATICCLASSNAME);
|
---|
34 | if(atom) GlobalDeleteAtom(atom);
|
---|
35 | atom = GlobalFindAtomA(SCROLLBARCLASSNAME);
|
---|
36 | if(atom) GlobalDeleteAtom(atom);
|
---|
37 | atom = GlobalFindAtomA(LISTBOXCLASSNAME);
|
---|
38 | if(atom) GlobalDeleteAtom(atom);
|
---|
39 | atom = GlobalFindAtomA(COMBOLBOXCLASSNAME);
|
---|
40 | if(atom) GlobalDeleteAtom(atom);
|
---|
41 | atom = GlobalFindAtomA(COMBOBOXCLASSNAME);
|
---|
42 | if(atom) GlobalDeleteAtom(atom);
|
---|
43 | atom = GlobalFindAtomA(EDITCLASSNAME);
|
---|
44 | if(atom) GlobalDeleteAtom(atom);
|
---|
45 | atom = GlobalFindAtomA(MDICLIENTCLASSNAMEA);
|
---|
46 | if(atom) GlobalDeleteAtom(atom);
|
---|
47 | //END to be removed code
|
---|
48 |
|
---|
49 | dprintf(("Register BUTTON class"));
|
---|
50 | controlAtoms[BUTTON_CONTROL] = BUTTON_Register();
|
---|
51 | if (!controlAtoms[BUTTON_CONTROL]) dprintf(("failed!!!"));
|
---|
52 |
|
---|
53 | dprintf(("Register STATIC class"));
|
---|
54 | controlAtoms[STATIC_CONTROL] = STATIC_Register();
|
---|
55 | if (!controlAtoms[STATIC_CONTROL]) dprintf(("failed!!!"));
|
---|
56 |
|
---|
57 | dprintf(("Register SCROLLBAR class"));
|
---|
58 | controlAtoms[SCROLLBAR_CONTROL] = SCROLLBAR_Register();
|
---|
59 | if (!controlAtoms[SCROLLBAR_CONTROL]) dprintf(("failed!!!"));
|
---|
60 |
|
---|
61 | dprintf(("Register LISTBOX class"));
|
---|
62 | controlAtoms[LISTBOX_CONTROL] = LISTBOX_Register();
|
---|
63 | if (!controlAtoms[LISTBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
64 |
|
---|
65 | dprintf(("Register COMBOLBOX class"));
|
---|
66 | controlAtoms[COMBOLBOX_CONTROL] = COMBOLBOX_Register();
|
---|
67 | if (!controlAtoms[COMBOLBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
68 |
|
---|
69 | dprintf(("Register COMBOBOX class"));
|
---|
70 | controlAtoms[COMBOBOX_CONTROL] = COMBOBOX_Register();
|
---|
71 | if (!controlAtoms[COMBOBOX_CONTROL]) dprintf(("failed!!!"));
|
---|
72 |
|
---|
73 | dprintf(("Register EDIT class"));
|
---|
74 | controlAtoms[EDIT_CONTROL] = EDIT_Register();
|
---|
75 | if (!controlAtoms[EDIT_CONTROL]) dprintf(("failed!!!"));
|
---|
76 |
|
---|
77 | dprintf(("Register MDICLIENT class"));
|
---|
78 | controlAtoms[MDICLIENT_CONTROL] = MDICLIENT_Register();
|
---|
79 | if (!controlAtoms[MDICLIENT_CONTROL]) dprintf(("failed!!!"));
|
---|
80 |
|
---|
81 | dprintf(("Register DIALOG class"));
|
---|
82 | controlAtoms[DIALOG_CONTROL] = DIALOG_Register();
|
---|
83 | if (!controlAtoms[DIALOG_CONTROL]) dprintf(("failed!!!"));
|
---|
84 |
|
---|
85 | dprintf(("Register DESKTOP class"));
|
---|
86 | controlAtoms[DESKTOP_CONTROL] = DESKTOP_Register();
|
---|
87 | if (!controlAtoms[DESKTOP_CONTROL]) dprintf(("failed!!!"));
|
---|
88 | }
|
---|
89 |
|
---|
90 | void CONTROLS_Unregister()
|
---|
91 | {
|
---|
92 | dprintf(("Unregister BUTTON class"));
|
---|
93 | if (!BUTTON_Unregister()) dprintf(("failed!!!"));
|
---|
94 |
|
---|
95 | dprintf(("Unregister STATIC class"));
|
---|
96 | if (!STATIC_Unregister()) dprintf(("failed!!!"));
|
---|
97 |
|
---|
98 | dprintf(("Unregister SCROLLBAR class"));
|
---|
99 | if (!SCROLLBAR_Unregister()) dprintf(("failed!!!"));
|
---|
100 |
|
---|
101 | dprintf(("Unregister LISTBOX class"));
|
---|
102 | if (!LISTBOX_Unregister()) dprintf(("failed!!!"));
|
---|
103 |
|
---|
104 | dprintf(("Unregister COMBOLBOX class"));
|
---|
105 | if (!COMBOLBOX_Unregister()) dprintf(("failed!!!"));
|
---|
106 |
|
---|
107 | dprintf(("Unregister COMBOBOX class"));
|
---|
108 | if (!COMBOBOX_Unregister()) dprintf(("failed!!!"));
|
---|
109 |
|
---|
110 | dprintf(("Unregister EDIT class"));
|
---|
111 | if (!EDIT_Unregister()) dprintf(("failed!!!"));
|
---|
112 |
|
---|
113 | dprintf(("Unregister MDICLIENT class"));
|
---|
114 | if (!MDICLIENT_Unregister()) dprintf(("failed!!!"));
|
---|
115 |
|
---|
116 | dprintf(("Unregister DIALOG class"));
|
---|
117 | if (!DIALOG_Unregister()) dprintf(("failed!!!"));
|
---|
118 |
|
---|
119 | dprintf(("Unregister DESKTOP class"));
|
---|
120 | if (!DESKTOP_Unregister()) dprintf(("failed!!!"));
|
---|
121 | }
|
---|
122 |
|
---|
123 |
|
---|
124 | BOOL WIDGETS_IsControl(Win32BaseWindow *window, int control)
|
---|
125 | {
|
---|
126 | if(control >= MAX_CONTROLS || window == NULL || window->getClass() == NULL)
|
---|
127 | return FALSE;
|
---|
128 |
|
---|
129 | return controlAtoms[control] == window->getClass()->getAtom();
|
---|
130 | }
|
---|
131 |
|
---|