Mercurial > dwindows
annotate os2/dw.c @ 90:eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 22 Apr 2002 08:34:35 +0000 |
parents | ab77a22a2a36 |
children | 98cce029a611 |
rev | line source |
---|---|
3 | 1 /* |
2 * Dynamic Windows: | |
3 * A GTK like implementation of the PM GUI | |
4 * | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5 * (C) 2000-2002 Brian Smith <dbsoft@technologist.com> |
3 | 6 * (C) 2000 Achim Hasenmueller <achimha@innotek.de> |
7 * (C) 2000 Peter Nielsen <peter@pmview.com> | |
8 * (C) 1998 Sergey I. Yevtushenko (some code borrowed from cell toolkit) | |
9 * | |
10 */ | |
11 #define INCL_DOS | |
12 #define INCL_DOSERRORS | |
13 #define INCL_WIN | |
14 #define INCL_GPI | |
15 | |
16 #include <os2.h> | |
17 #include <stdlib.h> | |
18 #include <string.h> | |
19 #include <stdio.h> | |
20 #include <stdarg.h> | |
21 #include <stddef.h> | |
22 #include <ctype.h> | |
23 #include <process.h> | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
24 #include <time.h> |
3 | 25 #include "dw.h" |
26 | |
27 #define QWP_USER 0 | |
28 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
29 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
30 |
3 | 31 char ClassName[] = "dynamicwindows"; |
32 char SplitbarClassName[] = "dwsplitbar"; | |
33 char DefaultFont[] = "9.WarpSans"; | |
34 | |
35 /* this is the callback handle for the window procedure | |
36 * make sure you always match the calling convention! | |
37 */ | |
38 int (* EXPENTRY filterfunc)(HWND, ULONG, MPARAM, MPARAM) = 0L; | |
39 | |
40 HAB dwhab = 0; | |
41 HMQ dwhmq = 0; | |
42 DWTID _dwtid = 0; | |
43 LONG _foreground = 0xAAAAAA, _background = 0; | |
44 | |
45 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE; | |
46 PRECORDCORE pCore = NULL; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
47 ULONG aulBuffer[4]; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
48 HWND lasthcnr = 0, lastitem = 0; |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
49 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
50 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) |
3 | 51 |
52 #ifndef min | |
53 #define min(a, b) (((a < b) ? a : b)) | |
54 #endif | |
55 | |
56 #ifdef DWDEBUG | |
57 FILE *f; | |
58 | |
59 void reopen(void) | |
60 { | |
61 fclose(f); | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
62 f = fopen("dw.log", "a+"); |
3 | 63 } |
64 #endif | |
65 | |
66 static LONG lColor[SPLITBAR_WIDTH] = | |
67 { | |
68 DW_CLR_BLACK, | |
69 DW_CLR_PALEGRAY, | |
70 DW_CLR_WHITE | |
71 }; | |
72 | |
73 #ifdef NO_SIGNALS | |
74 #define USE_FILTER | |
75 #else | |
76 typedef struct _sighandler | |
77 { | |
78 struct _sighandler *next; | |
79 ULONG message; | |
80 HWND window; | |
81 void *signalfunction; | |
82 void *data; | |
83 | |
84 } SignalHandler; | |
85 | |
86 SignalHandler *Root = NULL; | |
87 | |
88 typedef struct | |
89 { | |
90 ULONG message; | |
91 char name[30]; | |
92 | |
93 } SignalList; | |
94 | |
95 /* List of signals and their equivilent OS/2 message */ | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
96 #define SIGNALMAX 15 |
3 | 97 |
98 SignalList SignalTranslate[SIGNALMAX] = { | |
99 { WM_SIZE, "configure_event" }, | |
100 { WM_CHAR, "key_press_event" }, | |
101 { WM_BUTTON1DOWN, "button_press_event" }, | |
102 { WM_BUTTON1UP, "button_release_event"}, | |
103 { WM_MOUSEMOVE, "motion_notify_event" }, | |
104 { WM_CLOSE, "delete_event" }, | |
105 { WM_PAINT, "expose_event" }, | |
106 { WM_COMMAND, "clicked" }, | |
107 { CN_ENTER, "container-select" }, | |
108 { CN_CONTEXTMENU, "container-context" }, | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
109 { LN_SELECT, "item-select" }, |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
110 { CN_EMPHASIS, "tree-select" }, |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
111 { WM_SETFOCUS, "set-focus" }, |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
112 { WM_USER+1, "lose-focus" }, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
113 { SLN_SLIDERTRACK, "value_changed" } |
3 | 114 }; |
115 | |
116 /* This function adds a signal handler callback into the linked list. | |
117 */ | |
118 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data) | |
119 { | |
120 SignalHandler *new = malloc(sizeof(SignalHandler)); | |
121 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
122 #ifndef NO_SIGNALS |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
123 if(message == WM_COMMAND) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
124 dw_signal_disconnect_by_window(window); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
125 #endif |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
126 |
3 | 127 new->message = message; |
128 new->window = window; | |
129 new->signalfunction = signalfunction; | |
130 new->data = data; | |
131 new->next = NULL; | |
132 | |
133 if (!Root) | |
134 Root = new; | |
135 else | |
136 { | |
137 SignalHandler *prev = NULL, *tmp = Root; | |
138 while(tmp) | |
139 { | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
140 if(tmp->message == message && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
141 tmp->window == window && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
142 tmp->signalfunction == signalfunction) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
143 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
144 tmp->data = data; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
145 free(new); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
146 return; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
147 } |
3 | 148 prev = tmp; |
149 tmp = tmp->next; | |
150 } | |
151 if(prev) | |
152 prev->next = new; | |
153 else | |
154 Root = new; | |
155 } | |
156 } | |
157 | |
158 /* Finds the message number for a given signal name */ | |
159 ULONG _findsigmessage(char *signame) | |
160 { | |
161 int z; | |
162 | |
163 for(z=0;z<SIGNALMAX;z++) | |
164 { | |
165 if(stricmp(signame, SignalTranslate[z].name) == 0) | |
166 return SignalTranslate[z].message; | |
167 } | |
168 return 0L; | |
169 } | |
170 #endif | |
171 | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
172 typedef struct _CNRITEM |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
173 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
174 MINIRECORDCORE rc; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
175 HPOINTER hptrIcon; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
176 PVOID user; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
177 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
178 } CNRITEM, *PCNRITEM; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
179 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
180 |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
181 /* Find the desktop window handle */ |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
182 HWND _toplevel_window(HWND handle) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
183 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
184 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
185 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
186 /* Find the toplevel window */ |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
187 while((box = WinQueryWindow(lastbox, QW_PARENT)) > 0x80000001 && box > 0) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
188 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
189 lastbox = box; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
190 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
191 if(box > 0) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
192 return lastbox; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
193 return handle; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
194 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
195 |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
196 /* This function changes the owner of buttons in to the |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
197 * dynamicwindows handle to fix a problem in notebooks. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
198 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
199 void _fix_button_owner(HWND handle, HWND dw) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
200 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
201 HENUM henum; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
202 HWND child; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
203 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
204 henum = WinBeginEnumWindows(handle); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
205 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
206 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
207 char tmpbuf[100]; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
208 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
209 WinQueryClassName(child, 99, tmpbuf); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
210 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
211 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
212 WinSetOwner(child, dw); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
213 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
214 dw = child; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
215 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
216 _fix_button_owner(child, dw); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
217 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
218 WinEndEnumWindows(henum); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
219 return; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
220 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
221 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
222 void _disconnect_windows(HWND handle) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
223 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
224 HENUM henum; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
225 HWND child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
226 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
227 #ifndef NO_SIGNALS |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
228 dw_signal_disconnect_by_window(handle); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
229 #endif |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
230 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
231 henum = WinBeginEnumWindows(handle); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
232 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
233 _disconnect_windows(child); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
234 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
235 WinEndEnumWindows(henum); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
236 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
237 |
3 | 238 /* This function removes and handlers on windows and frees |
239 * the user memory allocated to it. | |
240 */ | |
241 void _free_window_memory(HWND handle) | |
242 { | |
243 HENUM henum; | |
244 HWND child; | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
245 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); |
3 | 246 |
247 #ifndef NO_SIGNALS | |
248 dw_signal_disconnect_by_window(handle); | |
249 #endif | |
250 | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
251 if(ptr) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
252 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
253 dw_window_set_data(handle, NULL, NULL); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
254 WinSetWindowPtr(handle, QWP_USER, 0); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
255 free(ptr); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
256 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
257 |
3 | 258 henum = WinBeginEnumWindows(handle); |
259 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
260 _free_window_memory(child); | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
261 |
3 | 262 WinEndEnumWindows(henum); |
263 return; | |
264 } | |
265 | |
266 /* This function returns 1 if the window (widget) handle | |
267 * passed to it is a valid window that can gain input focus. | |
268 */ | |
269 int _validate_focus(HWND handle) | |
270 { | |
271 char tmpbuf[100]; | |
272 | |
273 if(!handle) | |
274 return 0; | |
275 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
276 if(!WinIsWindowEnabled(handle)) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
277 return 0; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
278 |
3 | 279 WinQueryClassName(handle, 99, tmpbuf); |
280 | |
281 /* These are the window classes which can | |
282 * obtain input focus. | |
283 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
284 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
285 strncmp(tmpbuf, "#3", 3)==0 || /* Button */ |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
286 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
287 strncmp(tmpbuf, "#7", 3)==0 || /* List box */ |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
288 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
289 strncmp(tmpbuf, "#32", 4)==0 || /* Spinbutton */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
290 strncmp(tmpbuf, "#37", 4)==0 || /* Container */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
291 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */ |
3 | 292 return 1; |
293 return 0; | |
294 } | |
295 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
296 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) |
3 | 297 { |
298 int z; | |
299 static HWND lasthwnd, firsthwnd; | |
300 static int finish_searching; | |
301 | |
302 /* Start is 2 when we have cycled completely and | |
303 * need to set the focus to the last widget we found | |
304 * that was valid. | |
305 */ | |
306 if(start == 2) | |
307 { | |
308 if(lasthwnd) | |
309 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
310 return 0; | |
311 } | |
312 | |
313 /* Start is 1 when we are entering the function | |
314 * for the first time, it is zero when entering | |
315 * the function recursively. | |
316 */ | |
317 if(start == 1) | |
318 { | |
319 lasthwnd = handle; | |
320 finish_searching = 0; | |
321 firsthwnd = 0; | |
322 } | |
323 | |
324 /* Vertical boxes are inverted on OS/2 */ | |
325 if(box->type == BOXVERT) | |
326 { | |
327 for(z=0;z<box->count;z++) | |
328 { | |
329 if(box->items[z].type == TYPEBOX) | |
330 { | |
331 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); | |
332 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
333 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 334 return 1; |
335 } | |
336 else | |
337 { | |
338 if(box->items[z].hwnd == handle) | |
339 { | |
340 if(lasthwnd == handle && firsthwnd) | |
341 WinSetFocus(HWND_DESKTOP, firsthwnd); | |
342 else if(lasthwnd == handle && !firsthwnd) | |
343 finish_searching = 1; | |
344 else | |
345 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
346 | |
347 /* If we aren't looking for the last handle, | |
348 * return immediately. | |
349 */ | |
350 if(!finish_searching) | |
351 return 1; | |
352 } | |
353 if(_validate_focus(box->items[z].hwnd)) | |
354 { | |
355 /* Start is 3 when we are looking for the | |
356 * first valid item in the layout. | |
357 */ | |
358 if(start == 3) | |
359 { | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
360 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
361 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
362 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
363 return 1; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
364 } |
3 | 365 } |
366 | |
367 if(!firsthwnd) | |
368 firsthwnd = box->items[z].hwnd; | |
369 | |
370 lasthwnd = box->items[z].hwnd; | |
371 } | |
372 else | |
373 { | |
374 char tmpbuf[100] = ""; | |
375 | |
376 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
377 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 378 { |
379 Box *notebox; | |
380 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, | |
381 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); | |
382 | |
383 if(page) | |
384 { | |
385 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); | |
386 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
387 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 388 return 1; |
389 } | |
390 } | |
391 } | |
392 } | |
393 } | |
394 } | |
395 else | |
396 { | |
397 for(z=box->count-1;z>-1;z--) | |
398 { | |
399 if(box->items[z].type == TYPEBOX) | |
400 { | |
401 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); | |
402 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
403 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 404 return 1; |
405 } | |
406 else | |
407 { | |
408 if(box->items[z].hwnd == handle) | |
409 { | |
410 if(lasthwnd == handle && firsthwnd) | |
411 WinSetFocus(HWND_DESKTOP, firsthwnd); | |
412 else if(lasthwnd == handle && !firsthwnd) | |
413 finish_searching = 1; | |
414 else | |
415 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
416 | |
417 /* If we aren't looking for the last handle, | |
418 * return immediately. | |
419 */ | |
420 if(!finish_searching) | |
421 return 1; | |
422 } | |
423 if(_validate_focus(box->items[z].hwnd)) | |
424 { | |
425 /* Start is 3 when we are looking for the | |
426 * first valid item in the layout. | |
427 */ | |
428 if(start == 3) | |
429 { | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
430 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
431 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
432 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
433 return 1; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
434 } |
3 | 435 } |
436 | |
437 if(!firsthwnd) | |
438 firsthwnd = box->items[z].hwnd; | |
439 | |
440 lasthwnd = box->items[z].hwnd; | |
441 } | |
442 else | |
443 { | |
444 char tmpbuf[100] = ""; | |
445 | |
446 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
447 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 448 { |
449 Box *notebox; | |
450 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, | |
451 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); | |
452 | |
453 if(page) | |
454 { | |
455 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); | |
456 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
457 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 458 return 1; |
459 } | |
460 } | |
461 } | |
462 } | |
463 } | |
464 } | |
465 return 0; | |
466 } | |
467 | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
468 int _focus_check_box_back(Box *box, HWND handle, int start, HWND defaultitem) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
469 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
470 int z; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
471 static HWND lasthwnd, firsthwnd; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
472 static int finish_searching; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
473 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
474 /* Start is 2 when we have cycled completely and |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
475 * need to set the focus to the last widget we found |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
476 * that was valid. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
477 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
478 if(start == 2) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
479 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
480 if(lasthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
481 WinSetFocus(HWND_DESKTOP, lasthwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
482 return 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
483 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
484 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
485 /* Start is 1 when we are entering the function |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
486 * for the first time, it is zero when entering |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
487 * the function recursively. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
488 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
489 if(start == 1) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
490 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
491 lasthwnd = handle; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
492 finish_searching = 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
493 firsthwnd = 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
494 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
495 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
496 /* Vertical boxes are inverted on OS/2 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
497 if(box->type == BOXVERT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
498 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
499 for(z=box->count-1;z>-1;z--) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
500 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
501 if(box->items[z].type == TYPEBOX) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
502 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
503 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
504 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
505 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
506 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
507 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
508 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
509 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
510 if(box->items[z].hwnd == handle) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
511 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
512 if(lasthwnd == handle && firsthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
513 WinSetFocus(HWND_DESKTOP, firsthwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
514 else if(lasthwnd == handle && !firsthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
515 finish_searching = 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
516 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
517 WinSetFocus(HWND_DESKTOP, lasthwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
518 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
519 /* If we aren't looking for the last handle, |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
520 * return immediately. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
521 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
522 if(!finish_searching) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
523 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
524 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
525 if(_validate_focus(box->items[z].hwnd)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
526 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
527 /* Start is 3 when we are looking for the |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
528 * first valid item in the layout. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
529 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
530 if(start == 3) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
531 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
532 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
533 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
534 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
535 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
536 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
537 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
538 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
539 if(!firsthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
540 firsthwnd = box->items[z].hwnd; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
541 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
542 lasthwnd = box->items[z].hwnd; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
543 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
544 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
545 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
546 char tmpbuf[100] = ""; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
547 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
548 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
549 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
550 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
551 Box *notebox; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
552 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
553 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
554 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
555 if(page) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
556 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
557 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
558 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
559 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
560 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
561 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
562 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
563 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
564 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
565 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
566 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
567 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
568 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
569 for(z=0;z<box->count;z++) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
570 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
571 if(box->items[z].type == TYPEBOX) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
572 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
573 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
574 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
575 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
576 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
577 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
578 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
579 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
580 if(box->items[z].hwnd == handle) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
581 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
582 if(lasthwnd == handle && firsthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
583 WinSetFocus(HWND_DESKTOP, firsthwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
584 else if(lasthwnd == handle && !firsthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
585 finish_searching = 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
586 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
587 WinSetFocus(HWND_DESKTOP, lasthwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
588 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
589 /* If we aren't looking for the last handle, |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
590 * return immediately. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
591 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
592 if(!finish_searching) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
593 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
594 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
595 if(_validate_focus(box->items[z].hwnd)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
596 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
597 /* Start is 3 when we are looking for the |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
598 * first valid item in the layout. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
599 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
600 if(start == 3) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
601 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
602 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
603 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
604 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
605 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
606 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
607 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
608 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
609 if(!firsthwnd) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
610 firsthwnd = box->items[z].hwnd; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
611 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
612 lasthwnd = box->items[z].hwnd; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
613 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
614 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
615 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
616 char tmpbuf[100] = ""; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
617 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
618 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
619 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
620 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
621 Box *notebox; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
622 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
623 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
624 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
625 if(page) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
626 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
627 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
628 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
629 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
630 return 1; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
631 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
632 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
633 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
634 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
635 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
636 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
637 return 0; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
638 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
639 |
3 | 640 /* This function finds the first widget in the |
641 * layout and moves the current focus to it. | |
642 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
643 int _initial_focus(HWND handle) |
3 | 644 { |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
645 Box *thisbox = NULL; |
3 | 646 HWND box; |
647 | |
648 box = WinWindowFromID(handle, FID_CLIENT); | |
649 if(box) | |
650 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
651 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
652 return 1; |
3 | 653 |
654 if(thisbox) | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
655 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
656 return 0; |
3 | 657 } |
658 | |
659 /* This function finds the current widget in the | |
660 * layout and moves the current focus to the next item. | |
661 */ | |
662 void _shift_focus(HWND handle) | |
663 { | |
664 Box *thisbox; | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
665 HWND box, lastbox = _toplevel_window(handle); |
3 | 666 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
667 box = WinWindowFromID(lastbox, FID_CLIENT); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
668 if(box) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
669 thisbox = WinQueryWindowPtr(box, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
670 else |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
671 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
672 |
3 | 673 if(thisbox) |
674 { | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
675 if(_focus_check_box(thisbox, handle, 1, 0) == 0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
676 _focus_check_box(thisbox, handle, 2, 0); |
3 | 677 } |
678 } | |
679 | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
680 /* This function finds the current widget in the |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
681 * layout and moves the current focus to the next item. |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
682 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
683 void _shift_focus_back(HWND handle) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
684 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
685 Box *thisbox; |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
686 HWND box, lastbox = _toplevel_window(handle); |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
687 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
688 box = WinWindowFromID(lastbox, FID_CLIENT); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
689 if(box) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
690 thisbox = WinQueryWindowPtr(box, QWP_USER); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
691 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
692 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
693 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
694 if(thisbox) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
695 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
696 if(_focus_check_box_back(thisbox, handle, 1, 0) == 0) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
697 _focus_check_box_back(thisbox, handle, 2, 0); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
698 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
699 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
700 |
3 | 701 /* ResetWindow: |
702 * Resizes window to the exact same size to trigger | |
703 * recalculation of frame. | |
704 */ | |
705 void _ResetWindow(HWND hwndFrame) | |
706 { | |
707 SWP swp; | |
708 | |
709 WinQueryWindowPos(hwndFrame, &swp); | |
710 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy-1, SWP_SIZE); | |
711 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy, SWP_SIZE); | |
712 } | |
713 | |
714 /* This function will recursively search a box and add up the total height of it */ | |
715 void _count_size(HWND box, int type, int *xsize, int *xorigsize) | |
716 { | |
717 int size = 0, origsize = 0, z; | |
718 Box *tmp = WinQueryWindowPtr(box, QWP_USER); | |
719 | |
720 if(!tmp) | |
721 { | |
722 *xsize = *xorigsize = 0; | |
723 return; | |
724 } | |
725 | |
726 if(type == tmp->type) | |
727 { | |
728 /* If the box is going in the direction we want, then we | |
729 * return the entire sum of the items. | |
730 */ | |
731 for(z=0;z<tmp->count;z++) | |
732 { | |
733 if(tmp->items[z].type == TYPEBOX) | |
734 { | |
735 int s, os; | |
736 | |
737 _count_size(tmp->items[z].hwnd, type, &s, &os); | |
738 size += s; | |
739 origsize += os; | |
740 } | |
741 else | |
742 { | |
743 size += (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); | |
744 origsize += (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); | |
745 } | |
746 } | |
747 } | |
748 else | |
749 { | |
750 /* If the box is not going in the direction we want, then we only | |
751 * want to return the maximum value. | |
752 */ | |
753 int tmpsize = 0, tmporigsize = 0; | |
754 | |
755 for(z=0;z<tmp->count;z++) | |
756 { | |
757 if(tmp->items[z].type == TYPEBOX) | |
758 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); | |
759 else | |
760 { | |
761 tmpsize = (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); | |
762 tmporigsize = (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); | |
763 } | |
764 | |
765 if(tmpsize > size) | |
766 size = tmpsize; | |
767 } | |
768 } | |
769 | |
770 *xsize = size; | |
771 *xorigsize = origsize; | |
772 } | |
773 | |
774 | |
775 /* Function: TrackRectangle | |
776 * Abstract: Tracks given rectangle. | |
777 * | |
778 * If rclBounds is NULL, then track rectangle on entire desktop. | |
779 * rclTrack is in window coorditates and will be mapped to | |
780 * desktop. | |
781 */ | |
782 | |
783 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) | |
784 { | |
785 TRACKINFO track; | |
786 APIRET rc; | |
787 | |
788 track.cxBorder = 1; | |
789 track.cyBorder = 1; | |
790 track.cxGrid = 1; | |
791 track.cyGrid = 1; | |
792 track.cxKeyboard = 8; | |
793 track.cyKeyboard = 8; | |
794 | |
795 if(!rclTrack) | |
796 return FALSE; | |
797 | |
798 if(rclBounds) | |
799 { | |
800 track.rclBoundary = *rclBounds; | |
801 } | |
802 else | |
803 { | |
804 track.rclBoundary.yTop = | |
805 track.rclBoundary.xRight = 3000; | |
806 track.rclBoundary.yBottom = | |
807 track.rclBoundary.xLeft = -3000; | |
808 } | |
809 | |
810 track.rclTrack = *rclTrack; | |
811 | |
812 WinMapWindowPoints(hwndBase, | |
813 HWND_DESKTOP, | |
814 (PPOINTL)&track.rclTrack, | |
815 2); | |
816 | |
817 track.ptlMinTrackSize.x = track.rclTrack.xRight | |
818 - track.rclTrack.xLeft; | |
819 track.ptlMinTrackSize.y = track.rclTrack.yTop | |
820 - track.rclTrack.yBottom; | |
821 track.ptlMaxTrackSize.x = track.rclTrack.xRight | |
822 - track.rclTrack.xLeft; | |
823 track.ptlMaxTrackSize.y = track.rclTrack.yTop | |
824 - track.rclTrack.yBottom; | |
825 | |
826 track.fs = TF_MOVE | TF_ALLINBOUNDARY; | |
827 | |
828 rc = WinTrackRect(HWND_DESKTOP, 0, &track); | |
829 | |
830 if(rc) | |
831 *rclTrack = track.rclTrack; | |
832 | |
833 return rc; | |
834 } | |
835 | |
836 /* This function calculates how much space the widgets and boxes require | |
837 * and does expansion as necessary. | |
838 */ | |
839 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy, | |
840 int pass, int *usedpadx, int *usedpady) | |
841 { | |
842 int z, currentx = 0, currenty = 0; | |
843 int uymax = 0, uxmax = 0; | |
844 int upymax = 0, upxmax = 0; | |
845 /* Used for the SIZEEXPAND */ | |
846 int nux = *usedx, nuy = *usedy; | |
847 int nupx = *usedpadx, nupy = *usedpady; | |
848 | |
849 (*usedx) += (thisbox->pad * 2); | |
850 (*usedy) += (thisbox->pad * 2); | |
851 | |
852 for(z=0;z<thisbox->count;z++) | |
853 { | |
854 if(thisbox->items[z].type == TYPEBOX) | |
855 { | |
856 int initialx, initialy; | |
857 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
858 | |
859 initialx = x - (*usedx); | |
860 initialy = y - (*usedy); | |
861 | |
862 if(tmp) | |
863 { | |
864 int newx, newy; | |
865 int nux = *usedx, nuy = *usedy; | |
866 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2); | |
867 | |
868 /* On the second pass we know how big the box needs to be and how | |
869 * much space we have, so we can calculate a ratio for the new box. | |
870 */ | |
871 if(pass == 2) | |
872 { | |
873 int deep = *depth + 1; | |
874 | |
875 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy); | |
876 | |
877 tmp->upx = upx - *usedpadx; | |
878 tmp->upy = upy - *usedpady; | |
879 | |
880 newx = x - nux; | |
881 newy = y - nuy; | |
882 | |
883 tmp->width = thisbox->items[z].width = initialx - newx; | |
884 tmp->height = thisbox->items[z].height = initialy - newy; | |
885 | |
886 tmp->parentxratio = thisbox->xratio; | |
887 tmp->parentyratio = thisbox->yratio; | |
888 | |
889 tmp->parentpad = tmp->pad; | |
890 | |
891 /* Just in case */ | |
892 tmp->xratio = thisbox->xratio; | |
893 tmp->yratio = thisbox->yratio; | |
894 | |
895 #ifdef DWDEBUG | |
896 if(pass > 1) | |
897 { | |
898 fprintf(f, "FARK! depth %d\r\nwidth = %d, height = %d, nux = %d, nuy = %d, upx = %d, upy = %d xratio = %f, yratio = %f\r\n\r\n", | |
899 *depth, thisbox->items[z].width, thisbox->items[z].height, nux, nuy, tmp->upx, tmp->upy, tmp->xratio, tmp->yratio); | |
900 reopen(); | |
901 } | |
902 #endif | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
903 |
3 | 904 if(thisbox->type == BOXVERT) |
905 { | |
906 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
907 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))); | |
908 } | |
909 else | |
910 { | |
911 if((thisbox->items[z].width-tmp->upx)!=0) | |
912 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); | |
913 } | |
914 if(thisbox->type == BOXHORZ) | |
915 { | |
916 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
917 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))); | |
918 } | |
919 else | |
920 { | |
921 if((thisbox->items[z].height-tmp->upy)!=0) | |
922 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); | |
923 } | |
924 | |
925 nux = *usedx; nuy = *usedy; | |
926 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | |
927 } | |
928 | |
929 (*depth)++; | |
930 | |
931 #ifdef DWDEBUG | |
932 if(pass > 1) | |
933 { | |
934 fprintf(f, "Before Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n", | |
935 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio); | |
936 reopen(); | |
937 } | |
938 #endif | |
939 | |
940 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); | |
941 | |
942 (*depth)--; | |
943 | |
944 newx = x - nux; | |
945 newy = y - nuy; | |
946 | |
947 tmp->minwidth = thisbox->items[z].width = initialx - newx; | |
948 tmp->minheight = thisbox->items[z].height = initialy - newy; | |
949 | |
950 #ifdef DWDEBUG | |
951 if(pass > 1) | |
952 { | |
953 fprintf(f, "After Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d width = %d, height = %d\r\n\r\n", | |
954 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, thisbox->items[z].width, thisbox->items[z].height); | |
955 reopen(); | |
956 } | |
957 #endif | |
958 } | |
959 } | |
960 | |
961 if(pass > 1 && *depth > 0) | |
962 { | |
963 if(thisbox->type == BOXVERT) | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
964 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
965 if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
966 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
967 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
968 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
969 } |
3 | 970 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
971 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
972 if(thisbox->minwidth-thisbox->upx == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
973 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
974 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
975 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
976 } |
3 | 977 |
978 if(thisbox->type == BOXHORZ) | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
979 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
980 if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
981 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
982 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
983 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
984 } |
3 | 985 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
986 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
987 if(thisbox->minheight-thisbox->upy == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
988 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
989 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
990 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
991 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
992 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
993 if(thisbox->items[z].type == TYPEBOX) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
994 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
995 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
996 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
997 if(tmp) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
998 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
999 tmp->parentxratio = thisbox->items[z].xratio; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1000 tmp->parentyratio = thisbox->items[z].yratio; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1001 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1002 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1003 |
3 | 1004 #ifdef DWDEBUG |
1005 fprintf(f, "RATIO- xratio = %f, yratio = %f, width = %d, height = %d, pad = %d, box xratio = %f, box yratio = %f, parent xratio = %f, parent yratio = %f, minwidth = %d, minheight = %d, width = %d, height = %d, upx = %d, upy = %d\r\n\r\n", | |
1006 thisbox->items[z].xratio, thisbox->items[z].yratio, thisbox->items[z].width, thisbox->items[z].height, thisbox->items[z].pad, thisbox->xratio, thisbox->yratio, thisbox->parentxratio, thisbox->parentyratio, thisbox->minwidth, thisbox->minheight, thisbox->width, thisbox->height, thisbox->upx, thisbox->upy); | |
1007 reopen(); | |
1008 #endif | |
1009 } | |
1010 else | |
1011 { | |
1012 thisbox->items[z].xratio = thisbox->xratio; | |
1013 thisbox->items[z].yratio = thisbox->yratio; | |
1014 } | |
1015 | |
1016 if(thisbox->type == BOXVERT) | |
1017 { | |
1018 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) | |
1019 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); | |
1020 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1021 { | |
1022 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax) | |
1023 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1024 } | |
1025 else | |
1026 { | |
1027 if(thisbox->items[z].pad*2 > upxmax) | |
1028 upxmax = thisbox->items[z].pad*2; | |
1029 } | |
1030 } | |
1031 else | |
1032 { | |
1033 if(thisbox->items[z].width == -1) | |
1034 { | |
1035 /* figure out how much space this item requires */ | |
1036 /* thisbox->items[z].width = */ | |
1037 } | |
1038 else | |
1039 { | |
1040 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
1041 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1042 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1043 else | |
1044 (*usedpadx) += thisbox->items[z].pad*2; | |
1045 } | |
1046 } | |
1047 if(thisbox->type == BOXHORZ) | |
1048 { | |
1049 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) | |
1050 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); | |
1051 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1052 { | |
1053 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax) | |
1054 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1055 } | |
1056 else | |
1057 { | |
1058 if(thisbox->items[z].pad*2 > upymax) | |
1059 upymax = thisbox->items[z].pad*2; | |
1060 } | |
1061 } | |
1062 else | |
1063 { | |
1064 if(thisbox->items[z].height == -1) | |
1065 { | |
1066 /* figure out how much space this item requires */ | |
1067 /* thisbox->items[z].height = */ | |
1068 } | |
1069 else | |
1070 { | |
1071 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
1072 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1073 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1074 else | |
1075 (*usedpady) += thisbox->items[z].pad*2; | |
1076 } | |
1077 } | |
1078 } | |
1079 | |
1080 (*usedx) += uxmax; | |
1081 (*usedy) += uymax; | |
1082 (*usedpadx) += upxmax; | |
1083 (*usedpady) += upymax; | |
1084 | |
1085 currentx += thisbox->pad; | |
1086 currenty += thisbox->pad; | |
1087 | |
1088 #ifdef DWDEBUG | |
1089 fprintf(f, "Done Calc depth %d\r\nusedx = %d, usedy = %d, usedpadx = %d, usedpady = %d, currentx = %d, currenty = %d, uxmax = %d, uymax = %d\r\n\r\n", | |
1090 *depth, *usedx, *usedy, *usedpadx, *usedpady, currentx, currenty, uxmax, uymax); | |
1091 reopen(); | |
1092 #endif | |
1093 | |
1094 /* The second pass is for expansion and actual placement. */ | |
1095 if(pass > 1) | |
1096 { | |
1097 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | |
1098 for(z=0;z<thisbox->count;z++) | |
1099 { | |
1100 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT) | |
1101 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); | |
1102 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ) | |
1103 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); | |
1104 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | |
1105 if(thisbox->items[z].type == TYPEBOX) | |
1106 { | |
1107 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
1108 | |
1109 if(tmp) | |
1110 { | |
1111 if(*depth > 0) | |
1112 { | |
1113 if(thisbox->type == BOXVERT) | |
1114 { | |
1115 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); | |
1116 tmp->width = thisbox->items[z].width; | |
1117 } | |
1118 if(thisbox->type == BOXHORZ) | |
1119 { | |
1120 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); | |
1121 tmp->height = thisbox->items[z].height; | |
1122 } | |
1123 } | |
1124 | |
1125 (*depth)++; | |
1126 | |
1127 #ifdef DWDEBUG | |
1128 fprintf(f, "2- Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f,\r\nupx = %d, upy = %d, width = %d, height = %d, minwidth = %d, minheight = %d, box xratio = %f, box yratio = %f\r\n\r\n", | |
1129 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio, tmp->upx, tmp->upy, thisbox->items[z].width, thisbox->items[z].height, tmp->minwidth, tmp->minheight, thisbox->xratio, thisbox->yratio); | |
1130 reopen(); | |
1131 #endif | |
1132 | |
1133 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); | |
1134 | |
1135 (*depth)--; | |
1136 | |
1137 } | |
1138 } | |
1139 } | |
1140 | |
1141 for(z=0;z<(thisbox->count);z++) | |
1142 { | |
1143 int height = thisbox->items[z].height; | |
1144 int width = thisbox->items[z].width; | |
1145 int pad = thisbox->items[z].pad; | |
1146 HWND handle = thisbox->items[z].hwnd; | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
1147 int vectorx, vectory; |
3 | 1148 |
1149 /* When upxmax != pad*2 then ratios are incorrect. */ | |
1150 vectorx = (int)((width*thisbox->items[z].xratio)-width); | |
1151 vectory = (int)((height*thisbox->items[z].yratio)-height); | |
1152 | |
1153 if(width > 0 && height > 0) | |
1154 { | |
1155 char tmpbuf[100]; | |
1156 /* This is a hack to fix rounding of the sizing */ | |
1157 if(*depth == 0) | |
1158 { | |
1159 vectorx++; | |
1160 vectory++; | |
1161 } | |
1162 | |
1163 /* If this item isn't going to expand... reset the vectors to 0 */ | |
1164 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1165 vectory = 0; | |
1166 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1167 vectorx = 0; | |
1168 | |
1169 WinQueryClassName(handle, 99, tmpbuf); | |
1170 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
1171 if(strncmp(tmpbuf, "#2", 3)==0) |
3 | 1172 { |
1173 /* Make the combobox big enough to drop down. :) */ | |
1174 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100, | |
1175 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1176 } | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
1177 else if(strncmp(tmpbuf, "#6", 3)==0) |
3 | 1178 { |
1179 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ | |
1180 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, | |
1181 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1182 } | |
1183 else | |
1184 { | |
1185 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, | |
1186 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1187 if(thisbox->items[z].type == TYPEBOX) | |
1188 { | |
1189 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER); | |
1190 | |
1191 if(boxinfo && boxinfo->grouphwnd) | |
1192 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0, | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
1193 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE); |
3 | 1194 |
1195 } | |
1196 | |
1197 } | |
1198 | |
1199 #ifdef DWDEBUG | |
1200 fprintf(f, "Window Pos depth %d\r\ncurrentx = %d, currenty = %d, pad = %d, width = %d, height = %d, vectorx = %d, vectory = %d, Box type = %s\r\n\r\n", | |
1201 *depth, currentx, currenty, pad, width, height, vectorx, vectory,thisbox->type == BOXHORZ ? "Horizontal" : "Vertical"); | |
1202 reopen(); | |
1203 #endif | |
1204 | |
1205 if(thisbox->type == BOXHORZ) | |
1206 currentx += width + vectorx + (pad * 2); | |
1207 if(thisbox->type == BOXVERT) | |
1208 currenty += height + vectory + (pad * 2); | |
1209 } | |
1210 } | |
1211 } | |
1212 return 0; | |
1213 } | |
1214 | |
1215 void _do_resize(Box *thisbox, int x, int y) | |
1216 { | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
1217 if(x != 0 && y != 0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
1218 { |
3 | 1219 if(thisbox) |
1220 { | |
1221 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; | |
1222 | |
1223 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady); | |
1224 | |
1225 if(usedx-usedpadx == 0 || usedy-usedpady == 0) | |
1226 return; | |
1227 | |
1228 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); | |
1229 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); | |
1230 | |
1231 #ifdef DWDEBUG | |
1232 fprintf(f, "WM_SIZE Resize Box Pass 1\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n", | |
1233 x, y, usedx, usedy, usedpadx, usedpady, thisbox->xratio, thisbox->yratio); | |
1234 reopen(); | |
1235 #endif | |
1236 | |
1237 usedx = usedy = usedpadx = usedpady = depth = 0; | |
1238 | |
1239 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); | |
1240 #ifdef DWDEBUG | |
1241 fprintf(f, "WM_SIZE Resize Box Pass 2\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d\r\n", | |
1242 x, y, usedx, usedy, usedpadx, usedpady); | |
1243 reopen(); | |
1244 #endif | |
1245 } | |
1246 } | |
1247 } | |
1248 | |
1249 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ | |
1250 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1251 { | |
1252 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1253 Box *thisbox = NULL; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1254 HWND box; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1255 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1256 box = WinWindowFromID(hWnd, FID_CLIENT); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1257 if(box) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1258 thisbox = WinQueryWindowPtr(box, QWP_USER); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1259 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1260 if(thisbox && !thisbox->titlebar) |
3 | 1261 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1262 switch(msg) |
3 | 1263 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1264 case WM_QUERYTRACKINFO: |
3 | 1265 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1266 if(blah && *blah) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1267 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1268 PTRACKINFO ptInfo; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1269 int res; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1270 PFNWP myfunc = *blah; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1271 res = (int)myfunc(hWnd, msg, mp1, mp2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1272 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1273 ptInfo = (PTRACKINFO)(mp2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1274 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1275 ptInfo->ptlMinTrackSize.y = 8; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1276 ptInfo->ptlMinTrackSize.x = 8; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1277 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1278 return (MRESULT)res; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1279 } |
3 | 1280 } |
1281 } | |
1282 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1283 |
3 | 1284 if(blah && *blah) |
1285 { | |
1286 PFNWP myfunc = *blah; | |
1287 return myfunc(hWnd, msg, mp1, mp2); | |
1288 } | |
1289 | |
1290 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1291 } | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1292 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1293 void _Top(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1294 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1295 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1296 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1297 ptl1.x = rclPaint.xLeft; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1298 ptl2.y = ptl1.y = rclPaint.yTop - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1299 ptl2.x = rclPaint.xRight - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1300 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1301 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1302 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1303 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1304 /* Left hits the bottom */ |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1305 void _Left(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1306 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1307 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1308 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1309 ptl2.x = ptl1.x = rclPaint.xLeft; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1310 ptl1.y = rclPaint.yTop - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1311 ptl2.y = rclPaint.yBottom; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1312 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1313 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1314 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1315 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1316 void _Bottom(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1317 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1318 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1319 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1320 ptl1.x = rclPaint.xRight - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1321 ptl1.y = ptl2.y = rclPaint.yBottom; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1322 ptl2.x = rclPaint.xLeft; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1323 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1324 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1325 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1326 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1327 /* Right hits the top */ |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1328 void _Right(HPS hpsPaint, RECTL rclPaint) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1329 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1330 POINTL ptl1, ptl2; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1331 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1332 ptl2.x = ptl1.x = rclPaint.xRight - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1333 ptl1.y = rclPaint.yBottom + 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1334 ptl2.y = rclPaint.yTop - 1; |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1335 GpiMove(hpsPaint, &ptl1); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1336 GpiLine(hpsPaint, &ptl2); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1337 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1338 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1339 /* This procedure handles drawing of a status border */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1340 MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1341 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1342 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1343 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1344 if(blah && *blah) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1345 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1346 PFNWP myfunc = *blah; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1347 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1348 switch(msg) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1349 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1350 case WM_PAINT: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1351 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1352 HPS hpsPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1353 RECTL rclPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1354 char buf[1024]; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1355 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1356 hpsPaint = WinBeginPaint(hWnd, 0, 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1357 WinQueryWindowRect(hWnd, &rclPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1358 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1359 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1360 GpiSetColor(hpsPaint, CLR_DARKGRAY); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1361 _Top(hpsPaint, rclPaint); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1362 _Left(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1363 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1364 GpiSetColor(hpsPaint, CLR_WHITE); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1365 _Right(hpsPaint, rclPaint); |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1366 _Bottom(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1367 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1368 WinQueryWindowText(hWnd, 1024, buf); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1369 rclPaint.xLeft += 3; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1370 rclPaint.xRight--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1371 rclPaint.yTop--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1372 rclPaint.yBottom++; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1373 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1374 GpiSetColor(hpsPaint, CLR_BLACK); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1375 WinDrawText(hpsPaint, -1, buf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1376 WinEndPaint(hpsPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1377 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1378 return (MRESULT)TRUE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1379 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1380 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1381 return myfunc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1382 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1383 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1384 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1385 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1386 |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1387 void _click_default(HWND handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1388 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1389 char tmpbuf[100]; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1390 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1391 WinQueryClassName(handle, 99, tmpbuf); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1392 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1393 /* These are the window classes which can |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1394 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1395 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1396 if(strncmp(tmpbuf, "#3", 3)==0) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1397 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1398 /* Generate click on default item */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1399 SignalHandler *tmp = Root; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1400 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1401 /* Find any callbacks for this function */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1402 while(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1403 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1404 if(tmp->message == WM_COMMAND) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1405 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1406 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1407 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1408 /* Make sure it's the right window, and the right ID */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1409 if(tmp->window == handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1410 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1411 clickfunc(tmp->window, tmp->data); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1412 tmp = NULL; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1413 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1414 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1415 if(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1416 tmp= tmp->next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1417 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1418 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1419 else |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1420 WinSetFocus(HWND_DESKTOP, handle); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1421 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1422 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1423 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1424 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1425 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1426 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1427 switch(msg) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1428 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1429 case WM_SETFOCUS: |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1430 _run_event(hWnd, msg, mp1, mp2); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1431 break; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1432 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1433 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1434 if(blah && blah->oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1435 return blah->oldproc(hWnd, msg, mp1, mp2); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1436 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1437 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1438 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1439 |
3 | 1440 /* Originally just intended for entryfields, it now serves as a generic |
1441 * procedure for handling TAB presses to change input focus on controls. | |
1442 */ | |
1443 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1444 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1445 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1446 PFNWP oldproc = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1447 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1448 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1449 oldproc = blah->oldproc; |
3 | 1450 |
1451 switch(msg) | |
1452 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1453 case WM_BUTTON1DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1454 case WM_BUTTON2DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1455 case WM_BUTTON3DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1456 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1457 char tmpbuf[100]; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1458 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1459 WinQueryClassName(hWnd, 99, tmpbuf); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1460 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1461 if(strncmp(tmpbuf, "#32", 4)==0) |
38
538db2a48bac
Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1462 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1463 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1464 break; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1465 case WM_CONTROL: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1466 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1467 char tmpbuf[100]; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1468 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1469 WinQueryClassName(hWnd, 99, tmpbuf); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1470 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1471 if(strncmp(tmpbuf, "#38", 4)==0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1472 _run_event(hWnd, msg, mp1, mp2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1473 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1474 break; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1475 case WM_SETFOCUS: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1476 _run_event(hWnd, msg, mp1, mp2); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1477 break; |
3 | 1478 case WM_CHAR: |
1479 if(SHORT1FROMMP(mp2) == '\t') | |
1480 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1481 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1482 _shift_focus_back(hWnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1483 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1484 _shift_focus(hWnd); |
3 | 1485 return FALSE; |
1486 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1487 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1488 _click_default(blah->clickdefault); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1489 |
3 | 1490 break; |
1491 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1492 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1493 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1494 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1495 |
1496 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1497 } | |
1498 | |
1499 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN | |
1500 * flag enabled, and also handle TABs to switch input focus. | |
1501 */ | |
1502 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1503 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1504 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1505 PFNWP oldproc = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1506 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1507 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1508 oldproc = blah->oldproc; |
3 | 1509 |
1510 switch(msg) | |
1511 { | |
1512 case WM_CHAR: | |
1513 if(SHORT1FROMMP(mp2) == '\t') | |
1514 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1515 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1516 _shift_focus_back(hWnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1517 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
1518 _shift_focus(hWnd); |
3 | 1519 return FALSE; |
1520 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1521 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1522 _click_default(blah->clickdefault); |
3 | 1523 break; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1524 case WM_BUTTON1DOWN: |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1525 case WM_BUTTON2DOWN: |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1526 case WM_BUTTON3DOWN: |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1527 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1528 break; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1529 case WM_SETFOCUS: |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1530 _run_event(hWnd, msg, mp1, mp2); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1531 break; |
3 | 1532 case WM_PAINT: |
1533 { | |
1534 HWND parent = WinQueryWindow(hWnd, QW_PARENT); | |
1535 ULONG bcol, av[32]; | |
1536 HPS hpsPaint; | |
1537 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */ | |
1538 unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6; | |
1539 | |
1540 WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT); | |
1541 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); | |
1542 | |
1543 hpsPaint = WinGetPS(hWnd); | |
1544 GpiSetColor(hpsPaint, CLR_PALEGRAY); | |
1545 | |
1546 ptl.x = 0; | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
1547 ptl.y = 0; |
3 | 1548 GpiMove(hpsPaint, &ptl); |
1549 | |
1550 ptl.x = width; | |
1551 ptl.y = height - thumbheight; | |
1552 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); | |
1553 | |
1554 WinReleasePS(hpsPaint); | |
1555 } | |
1556 break; | |
1557 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1558 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1559 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1560 |
1561 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1562 } | |
1563 | |
1564 void _GetPPFont(HWND hwnd, char *buff) | |
1565 { | |
1566 ULONG AttrFound; | |
1567 BYTE AttrValue[128]; | |
1568 ULONG cbRetLen; | |
1569 | |
1570 cbRetLen = WinQueryPresParam(hwnd, | |
1571 PP_FONTNAMESIZE, | |
1572 0, | |
1573 &AttrFound, | |
1574 sizeof(AttrValue), | |
1575 &AttrValue, | |
1576 QPF_NOINHERIT); | |
1577 | |
1578 if(PP_FONTNAMESIZE == AttrFound && cbRetLen) | |
1579 { | |
1580 memcpy(buff, AttrValue, cbRetLen); | |
1581 } | |
1582 } | |
1583 | |
1584 /* Returns height of specified window. */ | |
1585 int _get_height(HWND handle) | |
1586 { | |
1587 unsigned long height; | |
1588 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); | |
1589 return (int)height; | |
1590 } | |
1591 | |
1592 /* Find the height of the frame a desktop style window is sitting on */ | |
1593 int _get_frame_height(HWND handle) | |
1594 { | |
1595 while(handle) | |
1596 { | |
1597 HWND client; | |
1598 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) | |
1599 { | |
1600 return _get_height(WinQueryWindow(handle, QW_PARENT)); | |
1601 } | |
1602 handle = WinQueryWindow(handle, QW_PARENT); | |
1603 } | |
1604 return dw_screen_height(); | |
1605 } | |
1606 | |
1607 #ifndef NO_SIGNALS | |
1608 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1609 { | |
1610 int result = -1; | |
1611 SignalHandler *tmp = Root; | |
1612 ULONG origmsg = msg; | |
1613 | |
1614 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) | |
1615 msg = WM_BUTTON1DOWN; | |
1616 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) | |
1617 msg = WM_BUTTON1UP; | |
1618 | |
1619 /* Find any callbacks for this function */ | |
1620 while(tmp) | |
1621 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1622 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1) |
3 | 1623 { |
1624 switch(msg) | |
1625 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1626 case WM_SETFOCUS: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1627 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1628 if((mp2 && tmp->message == WM_SETFOCUS) || (!mp2 && tmp->message == WM_USER+1)) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1629 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1630 int (*setfocusfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1631 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1632 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1633 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1634 result = setfocusfunc(tmp->window, tmp->data); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1635 tmp = NULL; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1636 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1637 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1638 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1639 break; |
3 | 1640 case WM_SIZE: |
1641 { | |
1642 int (*sizefunc)(HWND, int, int, void *) = (int (*)(HWND, int, int, void *))tmp->signalfunction; | |
1643 | |
1644 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) | |
1645 { | |
1646 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data); | |
1647 tmp = NULL; | |
1648 } | |
1649 } | |
1650 break; | |
1651 case WM_BUTTON1DOWN: | |
1652 { | |
1653 POINTS pts = (*((POINTS*)&mp1)); | |
1654 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; | |
1655 | |
1656 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
1657 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
1658 int button = 0; |
3 | 1659 |
1660 switch(origmsg) | |
1661 { | |
1662 case WM_BUTTON1DOWN: | |
1663 button = 1; | |
1664 break; | |
1665 case WM_BUTTON2DOWN: | |
1666 button = 2; | |
1667 break; | |
1668 case WM_BUTTON3DOWN: | |
1669 button = 3; | |
1670 break; | |
1671 } | |
1672 | |
1673 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data); | |
1674 tmp = NULL; | |
1675 } | |
1676 } | |
1677 break; | |
1678 case WM_BUTTON1UP: | |
1679 { | |
1680 POINTS pts = (*((POINTS*)&mp1)); | |
1681 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; | |
1682 | |
1683 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
1684 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
1685 int button = 0; |
3 | 1686 |
1687 switch(origmsg) | |
1688 { | |
1689 case WM_BUTTON1UP: | |
1690 button = 1; | |
1691 break; | |
1692 case WM_BUTTON2UP: | |
1693 button = 2; | |
1694 break; | |
1695 case WM_BUTTON3UP: | |
1696 button = 3; | |
1697 break; | |
1698 } | |
1699 | |
1700 result = buttonfunc(tmp->window, pts.x, WinQueryWindow(tmp->window, QW_PARENT) == HWND_DESKTOP ? dw_screen_height() - pts.y : _get_height(tmp->window) - pts.y, button, tmp->data); | |
1701 tmp = NULL; | |
1702 } | |
1703 } | |
1704 break; | |
1705 case WM_MOUSEMOVE: | |
1706 { | |
1707 int (*motionfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; | |
1708 | |
1709 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
1710 { | |
1711 int keys = 0; | |
1712 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1); | |
1713 | |
1714 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) | |
1715 keys = DW_BUTTON1_MASK; | |
1716 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) | |
1717 keys |= DW_BUTTON2_MASK; | |
1718 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) | |
1719 keys |= DW_BUTTON3_MASK; | |
1720 | |
1721 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data); | |
1722 tmp = NULL; | |
1723 } | |
1724 } | |
1725 break; | |
1726 case WM_CHAR: | |
1727 { | |
1728 int (*keypressfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; | |
1729 | |
1730 if(hWnd == tmp->window) | |
1731 { | |
1732 result = keypressfunc(tmp->window, SHORT1FROMMP(mp2), tmp->data); | |
1733 tmp = NULL; | |
1734 } | |
1735 } | |
1736 break; | |
1737 case WM_CLOSE: | |
1738 { | |
1739 int (*closefunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; | |
1740 | |
1741 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT)) | |
1742 { | |
1743 result = closefunc(tmp->window, tmp->data); | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1744 if(result) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1745 result = FALSE; |
3 | 1746 tmp = NULL; |
1747 } | |
1748 } | |
1749 break; | |
1750 case WM_PAINT: | |
1751 { | |
1752 HPS hps; | |
1753 DWExpose exp; | |
1754 int (*exposefunc)(HWND, DWExpose *, void *) = (int (*)(HWND, DWExpose *, void *))tmp->signalfunction; | |
1755 RECTL rc; | |
1756 | |
1757 if(hWnd == tmp->window) | |
1758 { | |
1759 int height = _get_height(hWnd); | |
1760 | |
1761 hps = WinBeginPaint(hWnd, 0L, &rc); | |
1762 exp.x = rc.xLeft; | |
1763 exp.y = height - rc.yTop - 1; | |
1764 exp.width = rc.xRight - rc. xLeft; | |
1765 exp.height = rc.yTop - rc.yBottom; | |
1766 result = exposefunc(hWnd, &exp, tmp->data); | |
1767 WinEndPaint(hps); | |
1768 } | |
1769 } | |
1770 break; | |
1771 case WM_COMMAND: | |
1772 { | |
1773 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; | |
1774 ULONG command = COMMANDMSG(&msg)->cmd; | |
1775 | |
1776 if(tmp->window < 65536 && command == tmp->window) | |
1777 { | |
1778 result = clickfunc(tmp->window, tmp->data); | |
1779 tmp = NULL; | |
1780 } | |
1781 } | |
1782 break; | |
1783 case WM_CONTROL: | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1784 if(tmp->message == SHORT2FROMMP(mp1) || (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE)) |
3 | 1785 { |
1786 switch(SHORT2FROMMP(mp1)) | |
1787 { | |
1788 case CN_ENTER: | |
1789 { | |
1790 int (*containerselectfunc)(HWND, char *, void *) = (int (*)(HWND, char *, void *))tmp->signalfunction; | |
1791 int id = SHORT1FROMMP(mp1); | |
1792 HWND conthwnd = dw_window_from_id(hWnd, id); | |
1793 char *text = NULL; | |
1794 | |
1795 if(mp2) | |
1796 { | |
1797 PRECORDCORE pre; | |
1798 | |
1799 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; | |
1800 if(pre) | |
1801 text = pre->pszIcon; | |
1802 } | |
1803 | |
1804 if(tmp->window == conthwnd) | |
1805 { | |
1806 result = containerselectfunc(tmp->window, text, tmp->data); | |
1807 tmp = NULL; | |
1808 } | |
1809 } | |
1810 break; | |
1811 case CN_CONTEXTMENU: | |
1812 { | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1813 int (*containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (*)(HWND, char *, int, int, void *, void *))tmp->signalfunction; |
3 | 1814 int id = SHORT1FROMMP(mp1); |
1815 HWND conthwnd = dw_window_from_id(hWnd, id); | |
1816 char *text = NULL; | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1817 void *user = NULL; |
3 | 1818 LONG x,y; |
1819 | |
1820 if(mp2) | |
1821 { | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1822 PCNRITEM pci; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1823 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1824 pci = (PCNRITEM)mp2; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1825 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1826 text = pci->rc.pszIcon; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1827 user = pci->user; |
3 | 1828 } |
1829 | |
1830 dw_pointer_query_pos(&x, &y); | |
1831 | |
1832 if(tmp->window == conthwnd) | |
1833 { | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1834 if(mp2) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1835 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1836 NOTIFYRECORDEMPHASIS pre; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1837 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1838 dw_tree_item_select(tmp->window, (HWND)mp2); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1839 pre.pRecord = mp2; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1840 pre.fEmphasisMask = CRA_CURSORED; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1841 pre.hwndCnr = tmp->window; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1842 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1843 pre.pRecord->flRecordAttr |= CRA_CURSORED; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1844 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1845 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); |
3 | 1846 tmp = NULL; |
1847 } | |
1848 } | |
1849 break; | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1850 case CN_EMPHASIS: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1851 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1852 PNOTIFYRECORDEMPHASIS pre = (PNOTIFYRECORDEMPHASIS)mp2; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1853 static int emph_recurse = 0; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1854 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1855 if(!emph_recurse) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1856 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1857 emph_recurse = 1; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1858 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1859 if(mp2) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1860 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1861 if(tmp->window == pre->hwndCnr) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1862 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1863 PCNRITEM pci = (PCNRITEM)pre->pRecord; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1864 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1865 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED)) |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1866 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1867 int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (*)(HWND, HWND, char *, void *, void *))tmp->signalfunction; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1868 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1869 if(lasthcnr == tmp->window && lastitem == (HWND)pci) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1870 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1871 lasthcnr = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1872 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1873 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1874 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1875 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1876 lasthcnr = tmp->window; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1877 lastitem = (HWND)pci; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1878 result = treeselectfunc(tmp->window, (HWND)pci, pci->rc.pszIcon, pci->user, tmp->data); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1879 } |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1880 tmp = NULL; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1881 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1882 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1883 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1884 emph_recurse = 0; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1885 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1886 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
1887 break; |
3 | 1888 case LN_SELECT: |
1889 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1890 char classbuf[100]; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1891 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1892 WinQueryClassName(tmp->window, 99, classbuf); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1893 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1894 if(strncmp(classbuf, "#38", 4) == 0) |
3 | 1895 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1896 int (*valuechangedfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1897 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1898 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1899 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1900 static int lastvalue = -1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1901 static HWND lasthwnd = NULLHANDLE; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1902 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1903 if(lastvalue != ulValue || lasthwnd != tmp->window) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1904 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1905 result = valuechangedfunc(tmp->window, ulValue, tmp->data); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1906 lastvalue = ulValue; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1907 lasthwnd = tmp->window; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1908 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1909 tmp = NULL; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1910 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1911 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1912 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1913 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1914 int (*listboxselectfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1915 int id = SHORT1FROMMP(mp1); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1916 HWND conthwnd = dw_window_from_id(hWnd, id); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1917 static int _recursing = 0; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1918 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1919 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) |
3 | 1920 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1921 char buf1[500]; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1922 unsigned int index = dw_listbox_selected(tmp->window); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1923 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1924 dw_listbox_query_text(tmp->window, index, buf1, 500); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1925 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1926 _recursing = 1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1927 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1928 if(id && strncmp(classbuf, "#2", 3)==0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1929 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1930 char *buf2; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1931 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1932 buf2 = dw_window_get_text(tmp->window); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1933 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1934 /* This is to make sure the listboxselect function doesn't |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1935 * get called if the user is modifying the entry text. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1936 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1937 if(buf2 && *buf2 && *buf1 && strncmp(buf1, buf2, 500) == 0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1938 result = listboxselectfunc(tmp->window, index, tmp->data); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1939 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1940 if(buf2) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1941 free(buf2); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1942 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1943 else |
3 | 1944 result = listboxselectfunc(tmp->window, index, tmp->data); |
1945 | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1946 _recursing = 0; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1947 tmp = NULL; |
3 | 1948 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1949 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1950 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1951 break; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1952 case SLN_SLIDERTRACK: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1953 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1954 int (*valuechangedfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1955 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1956 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1957 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1958 static int lastvalue = -1; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1959 static HWND lasthwnd = NULLHANDLE; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1960 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1961 if(lastvalue != ulValue || lasthwnd != tmp->window) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1962 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1963 result = valuechangedfunc(tmp->window, ulValue, tmp->data); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1964 lastvalue = ulValue; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1965 lasthwnd = tmp->window; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1966 } |
3 | 1967 tmp = NULL; |
1968 } | |
1969 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1970 |
3 | 1971 break; |
1972 } | |
1973 } | |
1974 break; | |
1975 } | |
1976 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
1977 |
3 | 1978 if(tmp) |
1979 tmp = tmp->next; | |
1980 | |
1981 } | |
1982 | |
1983 return (MRESULT)result; | |
1984 } | |
1985 #endif | |
1986 | |
1987 /* Handles control messages sent to the box (owner). */ | |
1988 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1989 { | |
1990 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
1991 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
1992 #ifndef NO_SIGNALS |
3 | 1993 switch(msg) |
1994 { | |
1995 case WM_CONTROL: | |
1996 _run_event(hWnd, msg, mp1, mp2); | |
1997 break; | |
1998 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
1999 #endif |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2000 |
3 | 2001 if(blah && blah->oldproc) |
2002 return blah->oldproc(hWnd, msg, mp1, mp2); | |
2003 | |
2004 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2005 } | |
2006 | |
2007 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | |
2008 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2009 { | |
2010 int result = -1; | |
2011 static int command_active = 0; | |
2012 void (* windowfunc)(PVOID) = 0L; | |
2013 | |
2014 if(filterfunc) | |
2015 result = filterfunc(hWnd, msg, mp1, mp2); | |
2016 | |
2017 #ifndef NO_SIGNALS | |
2018 if(result == -1 && !command_active) | |
2019 { | |
2020 /* Make sure we don't end up in infinite recursion */ | |
2021 command_active = 1; | |
2022 | |
2023 result = (int)_run_event(hWnd, msg, mp1, mp2); | |
2024 | |
2025 command_active = 0; | |
2026 } | |
2027 #endif | |
2028 | |
2029 /* Now that any handlers are done... do normal processing */ | |
2030 switch( msg ) | |
2031 { | |
2032 case WM_ERASEBACKGROUND: | |
2033 return 0; | |
2034 | |
2035 case WM_PAINT: | |
2036 { | |
2037 HPS hps; | |
2038 RECTL rc; | |
2039 | |
2040 hps = WinBeginPaint( hWnd, 0L, &rc ); | |
2041 WinEndPaint( hps ); | |
2042 break; | |
2043 } | |
2044 | |
2045 case WM_SIZE: | |
2046 { | |
2047 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2048 | |
2049 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2)) | |
2050 return (MPARAM)TRUE; | |
2051 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2052 if(mybox && mybox->flags != DW_MINIMIZED) |
3 | 2053 { |
2054 /* Hide the window when recalculating to reduce | |
2055 * CPU load. | |
2056 */ | |
2057 WinShowWindow(hWnd, FALSE); | |
2058 | |
2059 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); | |
2060 | |
2061 WinShowWindow(hWnd, TRUE); | |
2062 } | |
2063 } | |
2064 break; | |
2065 case WM_MINMAXFRAME: | |
2066 { | |
2067 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2068 SWP *swp = (SWP *)mp1; | |
2069 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2070 if(mybox && (swp->fl & SWP_MINIMIZE)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2071 mybox->flags = DW_MINIMIZED; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2072 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2073 if(mybox && (swp->fl & SWP_RESTORE)) |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2074 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2075 if(!mybox->titlebar && mybox->hwndtitle) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2076 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2077 mybox->flags = 0; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2078 } |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2079 |
3 | 2080 if(mybox && (swp->fl & SWP_MAXIMIZE)) |
2081 { | |
2082 int z; | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2083 SWP swp2; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2084 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2085 WinQueryWindowPos(swp->hwnd, &swp2); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2086 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2087 if(swp2.cx == swp->cx && swp2.cy == swp->cy) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2088 return FALSE; |
3 | 2089 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2090 mybox->flags = 0; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2091 |
3 | 2092 /* Hide the window when recalculating to reduce |
2093 * CPU load. | |
2094 */ | |
2095 WinShowWindow(hWnd, FALSE); | |
2096 | |
2097 _do_resize(mybox, swp->cx, swp->cy); | |
2098 | |
2099 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) | |
2100 { | |
2101 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); | |
2102 | |
2103 for(z=0;z<mybox->count;z++) | |
2104 { | |
2105 char tmpbuf[100]; | |
2106 | |
2107 WinQueryClassName(mybox->items[z].hwnd, 99, tmpbuf); | |
2108 | |
2109 /* If we have a notebook we resize the page again. */ | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2110 if(strncmp(tmpbuf, "#40", 4)==0) |
3 | 2111 { |
2112 unsigned long x, y, width, height; | |
2113 int page = dw_notebook_page_query(mybox->items[z].hwnd); | |
2114 HWND pagehwnd = (HWND)WinSendMsg(mybox->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(page), 0); | |
2115 RECTL rc; | |
2116 | |
2117 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER); | |
2118 if(pagebox) | |
2119 { | |
2120 dw_window_get_pos_size(mybox->items[z].hwnd, &x, &y, &width, &height); | |
2121 | |
2122 rc.xLeft = x; | |
2123 rc.yBottom = y; | |
2124 rc.xRight = x + width; | |
2125 rc.yTop = y + height; | |
2126 | |
2127 WinSendMsg(mybox->items[z].hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); | |
2128 | |
2129 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); | |
2130 } | |
2131 | |
2132 } | |
2133 } | |
2134 | |
2135 } | |
2136 | |
2137 WinShowWindow(hWnd, TRUE); | |
2138 } | |
2139 } | |
2140 break; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2141 case WM_CONTROL: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2142 switch(SHORT2FROMMP(mp1)) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2143 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2144 case BKN_PAGESELECTEDPENDING: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2145 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2146 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2147 HWND pagehwnd = (HWND)WinSendMsg(psn->hwndBook, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(psn->ulPageIdNew), 0); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2148 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2149 unsigned long x, y, width, height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2150 RECTL rc; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2151 |
21
c6e76b796b28
Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
20
diff
changeset
|
2152 if(pagebox && psn->ulPageIdNew != psn->ulPageIdCur) |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2153 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2154 dw_window_get_pos_size(psn->hwndBook, &x, &y, &width, &height); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2155 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2156 rc.xLeft = x; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2157 rc.yBottom = y; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2158 rc.xRight = x + width; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2159 rc.yTop = y + height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2160 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2161 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2162 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2163 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2164 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2165 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2166 break; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2167 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2168 break; |
3 | 2169 case WM_CLOSE: |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2170 if(result == -1) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2171 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2172 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2173 return (MRESULT)TRUE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2174 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2175 break; |
3 | 2176 case WM_USER: |
2177 windowfunc = (void (*)(void *))mp1; | |
2178 | |
2179 if(windowfunc) | |
2180 windowfunc((void *)mp2); | |
2181 break; | |
2182 case WM_CHAR: | |
2183 if(SHORT1FROMMP(mp2) == '\t') | |
2184 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2185 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2186 _shift_focus_back(hWnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2187 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2188 _shift_focus(hWnd); |
3 | 2189 return FALSE; |
2190 } | |
2191 break; | |
2192 case WM_DESTROY: | |
2193 /* Free memory before destroying */ | |
2194 _free_window_memory(hWnd); | |
2195 break; | |
2196 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2197 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2198 if(result != -1) |
3 | 2199 return (MRESULT)result; |
2200 else | |
2201 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2202 } | |
2203 | |
2204 void _changebox(Box *thisbox, int percent, int type) | |
2205 { | |
2206 int z; | |
2207 | |
2208 for(z=0;z<thisbox->count;z++) | |
2209 { | |
2210 if(thisbox->items[z].type == TYPEBOX) | |
2211 { | |
2212 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
2213 _changebox(tmp, percent, type); | |
2214 } | |
2215 else | |
2216 { | |
2217 if(type == BOXHORZ) | |
2218 { | |
2219 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2220 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2221 } | |
2222 else | |
2223 { | |
2224 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2225 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2226 } | |
2227 } | |
2228 } | |
2229 } | |
2230 | |
2231 /* This handles any activity on the splitbars (sizers) */ | |
2232 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2233 { | |
2234 HWND hwndFrame = 0; | |
2235 Box *thisbox = 0; | |
2236 | |
2237 hwndFrame = WinQueryWindow(hwnd, QW_PARENT); | |
2238 if(hwndFrame) | |
2239 thisbox = WinQueryWindowPtr(hwndFrame, QWL_USER); | |
2240 | |
2241 switch (msg) | |
2242 { | |
2243 case WM_ACTIVATE: | |
2244 case WM_SETFOCUS: | |
2245 return (MRESULT)(FALSE); | |
2246 | |
2247 case WM_PAINT: | |
2248 { | |
2249 HPS hpsPaint; | |
2250 RECTL rclPaint; | |
2251 POINTL ptlStart[SPLITBAR_WIDTH]; | |
2252 POINTL ptlEnd[SPLITBAR_WIDTH]; | |
2253 USHORT i; | |
2254 | |
2255 hpsPaint = WinBeginPaint(hwnd, 0, 0); | |
2256 WinQueryWindowRect(hwnd, &rclPaint); | |
2257 | |
2258 if(thisbox->type == BOXHORZ) | |
2259 { | |
2260 for(i = 0; i < SPLITBAR_WIDTH; i++) | |
2261 { | |
2262 ptlStart[i].x = rclPaint.xLeft + i; | |
2263 ptlStart[i].y = rclPaint.yTop; | |
2264 | |
2265 ptlEnd[i].x = rclPaint.xLeft + i; | |
2266 ptlEnd[i].y = rclPaint.yBottom; | |
2267 } | |
2268 } | |
2269 else | |
2270 { | |
2271 for(i = 0; i < SPLITBAR_WIDTH; i++) | |
2272 { | |
2273 ptlStart[i].x = rclPaint.xLeft; | |
2274 ptlStart[i].y = rclPaint.yBottom + i; | |
2275 | |
2276 ptlEnd[i].x = rclPaint.xRight; | |
2277 ptlEnd[i].y = rclPaint.yBottom + i; | |
2278 } | |
2279 } | |
2280 | |
2281 for(i = 0; i < SPLITBAR_WIDTH; i++) | |
2282 { | |
2283 GpiSetColor( hpsPaint, lColor[i]); | |
2284 GpiMove(hpsPaint, &ptlStart[i]); | |
2285 GpiLine(hpsPaint, &ptlEnd[i]); | |
2286 } | |
2287 WinEndPaint(hpsPaint); | |
2288 } | |
2289 return MRFROMSHORT(FALSE); | |
2290 | |
2291 case WM_MOUSEMOVE: | |
2292 { | |
2293 if(thisbox->type == BOXHORZ) | |
2294 WinSetPointer(HWND_DESKTOP, | |
2295 WinQuerySysPointer(HWND_DESKTOP, | |
2296 SPTR_SIZEWE, | |
2297 FALSE)); | |
2298 else | |
2299 WinSetPointer(HWND_DESKTOP, | |
2300 WinQuerySysPointer(HWND_DESKTOP, | |
2301 SPTR_SIZENS, | |
2302 FALSE)); | |
2303 } | |
2304 return MRFROMSHORT(FALSE); | |
2305 case WM_BUTTON1DOWN: | |
2306 { | |
2307 APIRET rc; | |
2308 RECTL rclFrame; | |
2309 RECTL rclBounds; | |
2310 RECTL rclStart; | |
2311 USHORT startSize, orig, actual; | |
2312 | |
2313 WinQueryWindowRect(hwnd, &rclFrame); | |
2314 WinQueryWindowRect(hwnd, &rclStart); | |
2315 | |
2316 WinQueryWindowRect(hwndFrame, &rclBounds); | |
2317 | |
2318 WinMapWindowPoints(hwndFrame, HWND_DESKTOP, | |
2319 (PPOINTL)&rclBounds, 2); | |
2320 WinMapWindowPoints(hwnd, HWND_DESKTOP, | |
2321 (PPOINTL)&rclStart, 2); | |
2322 | |
2323 { | |
2324 int z, pastsplitbar = FALSE, found = FALSE; | |
2325 orig = actual = 0; | |
2326 | |
2327 for(z=0;z<thisbox->count;z++) | |
2328 { | |
2329 if(thisbox->items[z].hwnd == hwnd) | |
2330 pastsplitbar = TRUE; | |
2331 else | |
2332 { | |
2333 if(thisbox->type == BOXHORZ) | |
2334 { | |
2335 int tmpwidth, tmporigwidth; | |
2336 | |
2337 if(thisbox->items[z].type == TYPEBOX) | |
2338 _count_size(thisbox->items[z].hwnd, BOXHORZ, &tmpwidth, &tmporigwidth); | |
2339 else | |
2340 { | |
2341 tmpwidth = thisbox->items[z].width; | |
2342 tmporigwidth = thisbox->items[z].origwidth; | |
2343 } | |
2344 | |
2345 if(thisbox->items[z].hsize != SIZESTATIC && tmpwidth > actual && tmporigwidth) | |
2346 { | |
2347 found = pastsplitbar; | |
2348 orig = tmporigwidth; | |
2349 actual = tmpwidth; | |
2350 } | |
2351 } | |
2352 else | |
2353 { | |
2354 int tmpheight, tmporigheight; | |
2355 | |
2356 if(thisbox->items[z].type == TYPEBOX) | |
2357 _count_size(thisbox->items[z].hwnd, BOXVERT, &tmpheight, &tmporigheight); | |
2358 else | |
2359 { | |
2360 tmpheight = thisbox->items[z].height; | |
2361 tmporigheight = thisbox->items[z].origheight; | |
2362 } | |
2363 | |
2364 if(thisbox->items[z].vsize != SIZESTATIC && tmpheight > actual && tmporigheight) | |
2365 { | |
2366 found = pastsplitbar; | |
2367 orig = tmporigheight; | |
2368 actual = tmpheight; | |
2369 } | |
2370 } | |
2371 } | |
2372 } | |
2373 | |
2374 /* If we couldn't determine a valid scale... then abort */ | |
2375 if(!orig || !actual) | |
2376 return MRFROMSHORT(FALSE); | |
2377 | |
2378 if(thisbox->type == BOXHORZ) | |
2379 { | |
2380 if(found) | |
2381 startSize = (rclStart.xLeft - rclBounds.xLeft) | |
2382 * (((float)actual)/((float)orig)); | |
2383 else | |
2384 startSize = (rclStart.xLeft - rclBounds.xLeft) | |
2385 * (((float)orig)/((float)actual)); | |
2386 } | |
2387 else | |
2388 { | |
2389 if(found) | |
2390 startSize = (rclStart.yBottom - rclBounds.yBottom) | |
2391 * (((float)actual)/((float)orig)); | |
2392 else | |
2393 startSize = (rclStart.yBottom - rclBounds.yBottom) | |
2394 * (((float)orig)/((float)actual)); | |
2395 } | |
2396 } | |
2397 | |
2398 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds); | |
2399 | |
2400 if(rc == TRUE) | |
2401 { | |
2402 USHORT usNewRB; | |
2403 USHORT percent; | |
2404 int z; | |
2405 | |
2406 if(thisbox->type == BOXHORZ) | |
2407 { | |
2408 usNewRB = rclFrame.xLeft | |
2409 - rclBounds.xLeft; | |
2410 } | |
2411 else | |
2412 { | |
2413 usNewRB = rclFrame.yBottom | |
2414 - rclBounds.yBottom; | |
2415 } | |
2416 | |
2417 /* We don't want the item to disappear completely */ | |
2418 if(!usNewRB) | |
2419 usNewRB++; | |
2420 | |
2421 if(!startSize) | |
2422 startSize++; | |
2423 | |
2424 percent = (usNewRB*100)/startSize; | |
2425 | |
2426 for(z=0;z<thisbox->count;z++) | |
2427 { | |
2428 if(thisbox->items[z].type == TYPEBOX) | |
2429 { | |
2430 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2431 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2432 if(tmp) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2433 _changebox(tmp, percent, thisbox->type); |
3 | 2434 } |
2435 else | |
2436 { | |
2437 if(thisbox->items[z].hwnd == hwnd) | |
2438 percent = (startSize*100)/usNewRB; | |
2439 | |
2440 if(thisbox->type == BOXHORZ) | |
2441 { | |
2442 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2443 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2444 } | |
2445 else | |
2446 { | |
2447 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2448 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2449 } | |
2450 } | |
2451 } | |
2452 | |
2453 _ResetWindow(WinQueryWindow(hwnd, QW_OWNER)); | |
2454 } | |
2455 } | |
2456 return MRFROMSHORT(FALSE); | |
2457 } | |
2458 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2459 } | |
2460 | |
2461 /* Function: BubbleProc | |
2462 * Abstract: Subclass procedure for bubble help | |
2463 */ | |
2464 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2465 { | |
2466 MRESULT res; | |
2467 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
2468 | |
2469 if(proc) | |
2470 res = proc(hwnd, msg, mp1, mp2); | |
2471 else | |
2472 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2473 | |
2474 if(msg == WM_PAINT) | |
2475 { | |
2476 POINTL ptl; | |
2477 HPS hpsTemp; | |
2478 RECTL rcl; | |
2479 int height, width; | |
2480 | |
2481 WinQueryWindowRect(hwnd, &rcl); | |
2482 height = rcl.yTop - rcl.yBottom - 1; | |
2483 width = rcl.xRight - rcl.xLeft - 1; | |
2484 | |
2485 /* Draw a border around the bubble help */ | |
2486 hpsTemp = WinGetPS(hwnd); | |
2487 GpiSetColor(hpsTemp, DW_CLR_BLACK); | |
2488 ptl.x = ptl.y = 0; | |
2489 GpiMove(hpsTemp, &ptl); | |
2490 ptl.x = 0; | |
2491 ptl.y = height; | |
2492 GpiLine(hpsTemp, &ptl); | |
2493 ptl.x = ptl.y = 0; | |
2494 GpiMove(hpsTemp, &ptl); | |
2495 ptl.y = 0; | |
2496 ptl.x = width; | |
2497 GpiLine(hpsTemp, &ptl); | |
2498 ptl.x = width; | |
2499 ptl.y = height; | |
2500 GpiMove(hpsTemp, &ptl); | |
2501 ptl.x = 0; | |
2502 ptl.y = height; | |
2503 GpiLine(hpsTemp, &ptl); | |
2504 ptl.x = width; | |
2505 ptl.y = height; | |
2506 GpiMove(hpsTemp, &ptl); | |
2507 ptl.y = 0; | |
2508 ptl.x = width; | |
2509 GpiLine(hpsTemp, &ptl); | |
2510 WinReleasePS(hpsTemp); | |
2511 } | |
2512 return res; | |
2513 } | |
2514 | |
2515 /* Function: BtProc | |
2516 * Abstract: Subclass procedure for buttons | |
2517 */ | |
2518 | |
2519 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2520 { | |
2521 BubbleButton *bubble; | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2522 PFNWP oldproc; |
3 | 2523 |
2524 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER); | |
2525 | |
2526 if(!bubble) | |
2527 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2528 | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2529 oldproc = bubble->pOldProc; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2530 |
3 | 2531 switch(msg) |
2532 { | |
2533 #ifndef NO_SIGNALS | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2534 case WM_SETFOCUS: |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2535 if(mp2) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2536 _run_event(hwnd, msg, mp1, mp2); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2537 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2538 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2539 break; |
3 | 2540 case WM_BUTTON1UP: |
2541 { | |
2542 SignalHandler *tmp = Root; | |
2543 | |
2544 if(WinIsWindowEnabled(hwnd)) | |
2545 { | |
2546 /* Find any callbacks for this function */ | |
2547 while(tmp) | |
2548 { | |
2549 if(tmp->message == WM_COMMAND) | |
2550 { | |
2551 /* Make sure it's the right window, and the right ID */ | |
2552 if(tmp->window == hwnd) | |
2553 { | |
2554 /* Due to the fact that if we run the function | |
2555 * here, finishing actions on the button will occur | |
2556 * after we run the signal handler. So we post the | |
2557 * message so the button can finish what it needs to | |
2558 * do before we run our handler. | |
2559 */ | |
2560 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2561 tmp = NULL; | |
2562 } | |
2563 } | |
2564 if(tmp) | |
2565 tmp= tmp->next; | |
2566 } | |
2567 } | |
2568 } | |
2569 break; | |
2570 case WM_USER: | |
2571 { | |
2572 SignalHandler *tmp = (SignalHandler *)mp1; | |
2573 int (*clickfunc)(HWND, void *) = NULL; | |
2574 | |
2575 if(tmp) | |
2576 { | |
2577 clickfunc = (int (*)(HWND, void *))tmp->signalfunction; | |
2578 | |
2579 clickfunc(tmp->window, tmp->data); | |
2580 } | |
2581 } | |
2582 break; | |
2583 #endif | |
2584 case WM_CHAR: | |
2585 { | |
2586 #ifndef NO_SIGNALS | |
2587 /* A button press should also occur for an ENTER or SPACE press | |
2588 * while the button has the active input focus. | |
2589 */ | |
2590 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') | |
2591 { | |
2592 SignalHandler *tmp = Root; | |
2593 | |
2594 /* Find any callbacks for this function */ | |
2595 while(tmp) | |
2596 { | |
2597 if(tmp->message == WM_COMMAND) | |
2598 { | |
2599 /* Make sure it's the right window, and the right ID */ | |
2600 if(tmp->window == hwnd) | |
2601 { | |
2602 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2603 tmp = NULL; | |
2604 } | |
2605 } | |
2606 if(tmp) | |
2607 tmp= tmp->next; | |
2608 } | |
2609 } | |
2610 #endif | |
2611 if(SHORT1FROMMP(mp2) == '\t') | |
2612 { | |
61
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2613 if(CHARMSG(&msg)->fs & KC_SHIFT) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2614 _shift_focus_back(hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2615 else |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2616 _shift_focus(hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2617 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2618 return FALSE; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2619 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2620 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_LEFT || CHARMSG(&msg)->vkey == VK_UP)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2621 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2622 _shift_focus_back(hwnd); |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2623 return FALSE; |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2624 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2625 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_RIGHT || CHARMSG(&msg)->vkey == VK_DOWN)) |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2626 { |
3 | 2627 _shift_focus(hwnd); |
2628 return FALSE; | |
2629 } | |
2630 } | |
2631 break; | |
2632 case 0x041f: | |
2633 if (hwndBubble) | |
2634 { | |
2635 WinDestroyWindow(hwndBubble); | |
2636 hwndBubble = 0; | |
2637 } | |
2638 break; | |
2639 | |
2640 case 0x041e: | |
2641 | |
2642 if(!*bubble->bubbletext) | |
2643 break; | |
2644 | |
2645 if(hwndBubble) | |
2646 { | |
2647 WinDestroyWindow(hwndBubble); | |
2648 hwndBubble = 0; | |
2649 } | |
2650 | |
2651 if(!hwndBubble) | |
2652 { | |
2653 HPS hpsTemp = 0; | |
2654 LONG lHight; | |
2655 LONG lWidth; | |
2656 POINTL txtPointl[TXTBOX_COUNT]; | |
2657 POINTL ptlWork = {0,0}; | |
2658 ULONG ulColor = DW_CLR_YELLOW; | |
2659 void *blah; | |
2660 | |
2661 hwndBubbleLast = hwnd; | |
2662 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
2663 WC_STATIC, | |
2664 "", | |
2665 SS_TEXT | | |
2666 DT_CENTER | | |
2667 DT_VCENTER, | |
2668 0,0,0,0, | |
2669 HWND_DESKTOP, | |
2670 HWND_TOP, | |
2671 0, | |
2672 NULL, | |
2673 NULL); | |
2674 | |
2675 WinSetPresParam(hwndBubble, | |
2676 PP_FONTNAMESIZE, | |
2677 sizeof(DefaultFont), | |
2678 DefaultFont); | |
2679 | |
2680 | |
2681 WinSetPresParam(hwndBubble, | |
2682 PP_BACKGROUNDCOLORINDEX, | |
2683 sizeof(ulColor), | |
2684 &ulColor); | |
2685 | |
2686 WinSetWindowText(hwndBubble, | |
2687 bubble->bubbletext); | |
2688 | |
2689 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
2690 | |
2691 hpsTemp = WinGetPS(hwndBubble); | |
2692 GpiQueryTextBox(hpsTemp, | |
2693 strlen(bubble->bubbletext), | |
2694 bubble->bubbletext, | |
2695 TXTBOX_COUNT, | |
2696 txtPointl); | |
2697 WinReleasePS(hpsTemp); | |
2698 | |
2699 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
2700 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
2701 | |
2702 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
2703 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
2704 | |
2705 ptlWork.y -= lHight; | |
2706 | |
2707 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
2708 | |
2709 if(blah) | |
2710 WinSetWindowPtr(hwndBubble, QWP_USER, blah); | |
2711 | |
2712 WinSetWindowPos(hwndBubble, | |
2713 HWND_TOP, | |
2714 ptlWork.x, | |
2715 ptlWork.y, | |
2716 lWidth, | |
2717 lHight, | |
2718 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
2719 } | |
2720 break; | |
2721 } | |
2722 | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2723 if(!oldproc) |
3 | 2724 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2725 return oldproc(hwnd, msg, mp1, mp2); |
3 | 2726 } |
2727 | |
2728 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2729 { | |
2730 int res = 0; | |
2731 #ifndef NO_SIGNALS | |
2732 res = (int)_run_event(hwnd, msg, mp1, mp2); | |
2733 #endif | |
2734 switch(msg) | |
2735 { | |
2736 case WM_BUTTON1DOWN: | |
2737 case WM_BUTTON2DOWN: | |
2738 case WM_BUTTON3DOWN: | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2739 if(res) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2740 return (MPARAM)TRUE; |
3 | 2741 } |
2742 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2743 } | |
2744 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2745 MRESULT EXPENTRY _TreeProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2746 { |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2747 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2748 PFNWP oldproc = 0; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2749 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2750 if(blah) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2751 oldproc = blah->oldproc; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2752 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2753 switch(msg) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2754 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2755 case WM_SETFOCUS: |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2756 _run_event(hwnd, msg, mp1, mp2); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2757 break; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2758 case WM_CHAR: |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2759 if(SHORT1FROMMP(mp2) == '\t') |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2760 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2761 if(CHARMSG(&msg)->fs & KC_SHIFT) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2762 _shift_focus_back(hwnd); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2763 else |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2764 _shift_focus(hwnd); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2765 return FALSE; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2766 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2767 break; |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2768 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2769 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2770 #ifndef NO_SIGNALS |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2771 _run_event(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2772 #endif |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2773 if(oldproc) |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2774 return oldproc(hwnd, msg, mp1, mp2); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2775 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2776 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2777 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2778 |
3 | 2779 /* |
2780 * Initializes the Dynamic Windows engine. | |
2781 * Parameters: | |
2782 * newthread: True if this is the only thread. | |
2783 * False if there is already a message loop running. | |
2784 */ | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2785 int dw_init(int newthread, int argc, char *argv[]) |
3 | 2786 { |
2787 APIRET rc; | |
2788 | |
2789 if(newthread) | |
2790 { | |
2791 dwhab = WinInitialize(0); | |
2792 dwhmq = WinCreateMsgQueue(dwhab, 0); | |
2793 } | |
2794 | |
2795 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | |
2796 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); | |
2797 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2798 /* Get the OS/2 version. */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2799 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2800 |
3 | 2801 #ifdef DWDEBUG |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2802 f = fopen("dw.log", "w"); |
3 | 2803 #endif |
2804 return rc; | |
2805 } | |
2806 | |
2807 /* | |
2808 * Runs a message loop for Dynamic Windows. | |
2809 * Parameters: | |
2810 * currenthab: The handle to the current anchor block | |
2811 * or NULL if this DW is handling the message loop. | |
2812 * func: Function pointer to the message filter function. | |
2813 */ | |
2814 void dw_main(HAB currenthab, void *func) | |
2815 { | |
2816 QMSG qmsg; | |
2817 HAB habtouse; | |
2818 | |
2819 if(!currenthab) | |
2820 habtouse = dwhab; | |
2821 else | |
2822 habtouse = currenthab; | |
2823 | |
2824 /* Setup the filter function */ | |
2825 filterfunc = (int (* EXPENTRY)(HWND, ULONG, MPARAM, MPARAM))func; | |
2826 | |
2827 _dwtid = dw_thread_id(); | |
2828 | |
2829 while (WinGetMsg(habtouse, &qmsg, 0, 0, 0)) | |
2830 WinDispatchMsg(habtouse, &qmsg); | |
2831 | |
2832 #ifdef DWDEBUG | |
2833 fclose(f); | |
2834 #endif | |
2835 | |
2836 if(!currenthab) | |
2837 { | |
2838 WinDestroyMsgQueue(dwhmq); | |
2839 WinTerminate(dwhab); | |
2840 } | |
2841 } | |
2842 | |
2843 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2844 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2845 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2846 * milliseconds: Number of milliseconds to run the loop for. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2847 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2848 void dw_main_sleep(int milliseconds) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2849 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2850 QMSG qmsg; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2851 double start = (double)clock(); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2852 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2853 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2854 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2855 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2856 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2857 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2858 WinDispatchMsg(dwhab, &qmsg); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2859 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2860 else |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2861 DosSleep(1); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2862 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2863 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2864 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2865 /* |
3 | 2866 * Free's memory allocated by dynamic windows. |
2867 * Parameters: | |
2868 * ptr: Pointer to dynamic windows allocated | |
2869 * memory to be free()'d. | |
2870 */ | |
2871 void dw_free(void *ptr) | |
2872 { | |
2873 free(ptr); | |
2874 } | |
2875 | |
2876 /* | |
2877 * Allocates and initializes a dialog struct. | |
2878 * Parameters: | |
2879 * data: User defined data to be passed to functions. | |
2880 */ | |
2881 DWDialog *dw_dialog_new(void *data) | |
2882 { | |
2883 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
2884 | |
2885 tmp->eve = dw_event_new(); | |
2886 dw_event_reset(tmp->eve); | |
2887 tmp->data = data; | |
2888 tmp->done = FALSE; | |
2889 tmp->result = NULL; | |
2890 | |
2891 return tmp; | |
2892 } | |
2893 | |
2894 /* | |
2895 * Accepts a dialog struct and returns the given data to the | |
2896 * initial called of dw_dialog_wait(). | |
2897 * Parameters: | |
2898 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
2899 * result: Data to be returned by dw_dialog_wait(). | |
2900 */ | |
2901 int dw_dialog_dismiss(DWDialog *dialog, void *result) | |
2902 { | |
2903 dialog->result = result; | |
2904 dw_event_post(dialog->eve); | |
2905 dialog->done = TRUE; | |
2906 return 0; | |
2907 } | |
2908 | |
2909 /* | |
2910 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
2911 * called by a signal handler with the given dialog struct. | |
2912 * Parameters: | |
2913 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
2914 */ | |
2915 void *dw_dialog_wait(DWDialog *dialog) | |
2916 { | |
2917 QMSG qmsg; | |
2918 void *tmp; | |
2919 | |
2920 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | |
2921 { | |
2922 WinDispatchMsg(dwhab, &qmsg); | |
2923 if(dialog->done) | |
2924 break; | |
2925 } | |
2926 dw_event_close(&dialog->eve); | |
2927 tmp = dialog->result; | |
2928 free(dialog); | |
2929 return tmp; | |
2930 } | |
2931 | |
2932 | |
2933 /* | |
2934 * Displays a Message Box with given text and title.. | |
2935 * Parameters: | |
2936 * title: The title of the message box. | |
2937 * format: printf style format string. | |
2938 * ...: Additional variables for use in the format. | |
2939 */ | |
2940 int dw_messagebox(char *title, char *format, ...) | |
2941 { | |
2942 va_list args; | |
2943 char outbuf[1024]; | |
2944 | |
2945 va_start(args, format); | |
2946 vsprintf(outbuf, format, args); | |
2947 va_end(args); | |
2948 | |
2949 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE); | |
2950 | |
2951 return strlen(outbuf); | |
2952 } | |
2953 | |
2954 /* | |
2955 * Displays a Message Box with given text and title.. | |
2956 * Parameters: | |
2957 * title: The title of the message box. | |
2958 * text: The text to display in the box. | |
2959 * Returns: | |
2960 * True if YES False of NO. | |
2961 */ | |
2962 int dw_yesno(char *title, char *text) | |
2963 { | |
2964 if(WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, title, 0, MB_YESNO | MB_INFORMATION | MB_MOVEABLE | MB_SYSTEMMODAL)==MBID_YES) | |
2965 return TRUE; | |
2966 return FALSE; | |
2967 } | |
2968 | |
2969 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2970 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2971 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2972 * handle: The window handle to make topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2973 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2974 int dw_window_raise(HWND handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2975 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2976 return WinSetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2977 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2978 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2979 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2980 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2981 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2982 * handle: The window handle to make bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2983 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2984 int dw_window_lower(HWND handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2985 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2986 return WinSetWindowPos(handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2987 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2988 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
2989 /* |
3 | 2990 * Makes the window visible. |
2991 * Parameters: | |
2992 * handle: The window handle to make visible. | |
2993 */ | |
2994 int dw_window_show(HWND handle) | |
2995 { | |
2996 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW); | |
2997 HSWITCH hswitch; | |
2998 SWCNTRL swcntrl; | |
2999 | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3000 _fix_button_owner(_toplevel_window(handle), 0); |
3 | 3001 WinSetFocus(HWND_DESKTOP, handle); |
3002 _initial_focus(handle); | |
3003 | |
3004 /* If this window has a switch list entry make sure it is visible */ | |
3005 hswitch = WinQuerySwitchHandle(handle, 0); | |
3006 if(hswitch) | |
3007 { | |
3008 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3009 swcntrl.uchVisibility = SWL_VISIBLE; | |
3010 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3011 } | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3012 if(WinWindowFromID(handle, FID_CLIENT)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3013 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3014 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3015 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3016 if(blah && !(blah->flags & DW_OS2_NEW_WINDOW)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3017 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3018 ULONG cx = dw_screen_width(), cy = dw_screen_height(); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3019 int newx, newy, changed = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3020 SWP swp; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3021 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3022 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3023 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3024 WinQueryWindowPos(handle, &swp); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3025 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3026 newx = swp.x; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3027 newy = swp.y; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3028 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3029 if((swp.x+swp.cx) > cx) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3030 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3031 newx = (cx - swp.cx)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3032 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3033 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3034 if((swp.y+swp.cy) > cy) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3035 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3036 newy = (cy - swp.cy)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3037 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3038 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3039 if(changed) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3040 WinSetWindowPos(handle, NULLHANDLE, newx, newy, 0, 0, SWP_MOVE); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3041 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3042 } |
3 | 3043 return rc; |
3044 } | |
3045 | |
3046 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3047 * Minimizes or Iconifies a top-level window. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3048 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3049 * handle: The window handle to minimize. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3050 */ |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3051 int dw_window_minimize(HWND handle) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3052 { |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3053 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3054 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3055 if(hwndclient) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3056 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3057 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3058 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3059 if(box) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3060 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3061 if(!box->titlebar && box->hwndtitle) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3062 WinSetParent(box->hwndtitle, handle, FALSE); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3063 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3064 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3065 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3066 return WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3067 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3068 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3069 /* |
3 | 3070 * Makes the window invisible. |
3071 * Parameters: | |
3072 * handle: The window handle to make visible. | |
3073 */ | |
3074 int dw_window_hide(HWND handle) | |
3075 { | |
3076 HSWITCH hswitch; | |
3077 SWCNTRL swcntrl; | |
3078 | |
3079 /* If this window has a switch list entry make sure it is invisible */ | |
3080 hswitch = WinQuerySwitchHandle(handle, 0); | |
3081 if(hswitch) | |
3082 { | |
3083 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3084 swcntrl.uchVisibility = SWL_INVISIBLE; | |
3085 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3086 } | |
3087 return WinShowWindow(handle, FALSE); | |
3088 } | |
3089 | |
3090 /* | |
3091 * Destroys a window and all of it's children. | |
3092 * Parameters: | |
3093 * handle: The window handle to destroy. | |
3094 */ | |
3095 int dw_window_destroy(HWND handle) | |
3096 { | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3097 HWND parent = WinQueryWindow(handle, QW_PARENT); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3098 Box *thisbox = WinQueryWindowPtr(parent, QWP_USER); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3099 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3100 if(!handle) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3101 return -1; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3102 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3103 if(parent != HWND_DESKTOP && thisbox && thisbox->count) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3104 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3105 int z, index = -1; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3106 Item *tmpitem, *thisitem = thisbox->items; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3107 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3108 for(z=0;z<thisbox->count;z++) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3109 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3110 if(thisitem[z].hwnd == handle) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3111 index = z; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3112 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3113 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3114 if(index == -1) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3115 return 0; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3116 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3117 tmpitem = malloc(sizeof(Item)*(thisbox->count-1)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3118 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3119 /* Copy all but the current entry to the new list */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3120 for(z=0;z<index;z++) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3121 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3122 tmpitem[z] = thisitem[z]; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3123 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3124 for(z=index+1;z<thisbox->count;z++) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3125 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3126 tmpitem[z-1] = thisitem[z]; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3127 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3128 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3129 thisbox->items = tmpitem; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3130 free(thisitem); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3131 thisbox->count--; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3132 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3133 _disconnect_windows(handle); |
3 | 3134 return WinDestroyWindow(handle); |
3135 } | |
3136 | |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3137 /* Causes entire window to be invalidated and redrawn. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3138 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3139 * handle: Toplevel window handle to be redrawn. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3140 */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3141 void dw_window_redraw(HWND handle) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3142 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3143 HWND window = WinWindowFromID(handle, FID_CLIENT); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3144 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3145 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3146 if(window && mybox) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3147 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3148 unsigned long width, height; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3149 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3150 dw_window_get_pos_size(window, NULL, NULL, &width, &height); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3151 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3152 WinShowWindow(mybox->items[0].hwnd, FALSE); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3153 _do_resize(mybox, width, height); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3154 WinShowWindow(mybox->items[0].hwnd, TRUE); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3155 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3156 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3157 |
3 | 3158 /* |
3159 * Changes a window's parent to newparent. | |
3160 * Parameters: | |
3161 * handle: The window handle to destroy. | |
3162 * newparent: The window's new parent window. | |
3163 */ | |
3164 void dw_window_reparent(HWND handle, HWND newparent) | |
3165 { | |
3166 HWND blah = WinWindowFromID(newparent, FID_CLIENT); | |
3167 WinSetParent(handle, blah ? blah : newparent, TRUE); | |
3168 } | |
3169 | |
3170 /* | |
3171 * Sets the font used by a specified window (widget) handle. | |
3172 * Parameters: | |
3173 * handle: The window (widget) handle. | |
3174 * fontname: Name and size of the font in the form "size.fontname" | |
3175 */ | |
3176 int dw_window_set_font(HWND handle, char *fontname) | |
3177 { | |
3178 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | |
3179 } | |
3180 | |
3181 /* | |
3182 * Sets the colors used by a specified window (widget) handle. | |
3183 * Parameters: | |
3184 * handle: The window (widget) handle. | |
3185 * fore: Foreground color in DW_RGB format or a default color index. | |
3186 * back: Background color in DW_RGB format or a default color index. | |
3187 */ | |
3188 int dw_window_set_color(HWND handle, ULONG fore, ULONG back) | |
3189 { | |
3190 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3191 { | |
3192 RGB2 rgb2; | |
3193 | |
3194 rgb2.bBlue = DW_BLUE_VALUE(fore); | |
3195 rgb2.bGreen = DW_GREEN_VALUE(fore); | |
3196 rgb2.bRed = DW_RED_VALUE(fore); | |
3197 rgb2.fcOptions = 0; | |
3198 | |
3199 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3200 | |
3201 } | |
3202 if((back & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3203 { | |
3204 RGB2 rgb2; | |
3205 | |
3206 rgb2.bBlue = DW_BLUE_VALUE(back); | |
3207 rgb2.bGreen = DW_GREEN_VALUE(back); | |
3208 rgb2.bRed = DW_RED_VALUE(back); | |
3209 rgb2.fcOptions = 0; | |
3210 | |
3211 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3212 return 0; | |
3213 } | |
3214 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3215 return 0; | |
3216 | |
3217 /* Slight conversion */ | |
3218 if(fore == DW_CLR_BLACK) | |
3219 fore = CLR_BLACK; | |
3220 if(fore == DW_CLR_WHITE) | |
3221 fore = CLR_WHITE; | |
3222 | |
3223 if(back == DW_CLR_BLACK) | |
3224 back = CLR_BLACK; | |
3225 if(back == DW_CLR_WHITE) | |
3226 back = CLR_WHITE; | |
3227 | |
3228 return (WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore) | | |
3229 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back)); | |
3230 } | |
3231 | |
3232 /* | |
3233 * Sets the font used by a specified window (widget) handle. | |
3234 * Parameters: | |
3235 * handle: The window (widget) handle. | |
3236 * border: Size of the window border in pixels. | |
3237 */ | |
3238 int dw_window_set_border(HWND handle, int border) | |
3239 { | |
3240 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border)); | |
3241 return 0; | |
3242 } | |
3243 | |
3244 /* | |
3245 * Captures the mouse input to this window. | |
3246 * Parameters: | |
3247 * handle: Handle to receive mouse input. | |
3248 */ | |
3249 void dw_window_capture(HWND handle) | |
3250 { | |
3251 WinSetCapture(HWND_DESKTOP, handle); | |
3252 } | |
3253 | |
3254 /* | |
3255 * Releases previous mouse capture. | |
3256 */ | |
3257 void dw_window_release(void) | |
3258 { | |
3259 WinSetCapture(HWND_DESKTOP, NULLHANDLE); | |
3260 } | |
3261 | |
3262 /* | |
3263 * Tracks this window movement. | |
3264 * Parameters: | |
3265 * handle: Handle to frame to be tracked. | |
3266 */ | |
3267 void dw_window_track(HWND handle) | |
3268 { | |
3269 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0); | |
3270 } | |
3271 | |
3272 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3273 * Changes the appearance of the mouse pointer. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3274 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3275 * handle: Handle to widget for which to change. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3276 * cursortype: ID of the pointer you want. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3277 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3278 void dw_window_pointer(HWND handle, int pointertype) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3279 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3280 WinSetPointer(handle, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3281 WinQuerySysPointer(HWND_DESKTOP, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3282 pointertype, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3283 FALSE)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3284 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3285 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3286 /* |
3 | 3287 * Create a new Window Frame. |
3288 * Parameters: | |
3289 * owner: The Owner's window handle or HWND_DESKTOP. | |
3290 * title: The Window title. | |
3291 * flStyle: Style flags, see the PM reference. | |
3292 */ | |
3293 HWND dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) | |
3294 { | |
3295 HWND hwndclient = 0, hwndframe; | |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3296 Box *newbox = calloc(1, sizeof(Box)); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3297 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3298 |
3299 newbox->pad = 0; | |
3300 newbox->type = BOXVERT; | |
3301 newbox->count = 0; | |
3302 | |
3303 flStyle |= FCF_NOBYTEALIGN; | |
3304 | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3305 if(flStyle & DW_FCF_TITLEBAR) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3306 newbox->titlebar = 1; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3307 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3308 flStyle |= FCF_TITLEBAR; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3309 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3310 if(!(flStyle & FCF_SHELLPOSITION)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3311 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3312 |
3 | 3313 hwndframe = WinCreateStdWindow(hwndOwner, 0L, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &hwndclient); |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3314 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR); |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3315 if(!newbox->titlebar && newbox->hwndtitle) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3316 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3317 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); |
3 | 3318 WinSetWindowPtr(hwndframe, QWP_USER, blah); |
3319 WinSetWindowPtr(hwndclient, QWP_USER, newbox); | |
3320 | |
3321 return hwndframe; | |
3322 } | |
3323 | |
3324 /* | |
3325 * Create a new Box to be packed. | |
3326 * Parameters: | |
3327 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | |
3328 * pad: Number of pixels to pad around the box. | |
3329 */ | |
3330 HWND dw_box_new(int type, int pad) | |
3331 { | |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3332 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3333 HWND hwndframe; |
3334 | |
3335 newbox->pad = pad; | |
3336 newbox->type = type; | |
3337 newbox->count = 0; | |
3338 newbox->grouphwnd = NULLHANDLE; | |
3339 | |
3340 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3341 WC_FRAME, | |
3342 NULL, | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3343 WS_VISIBLE | WS_CLIPCHILDREN | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3344 FS_NOBYTEALIGN, |
3 | 3345 0,0,2000,1000, |
3346 NULLHANDLE, | |
3347 HWND_TOP, | |
3348 0L, | |
3349 NULL, | |
3350 NULL); | |
3351 | |
3352 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc); | |
3353 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3354 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3355 return hwndframe; | |
3356 } | |
3357 | |
3358 /* | |
3359 * Create a new Group Box to be packed. | |
3360 * Parameters: | |
3361 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | |
3362 * pad: Number of pixels to pad around the box. | |
3363 * title: Text to be displayined in the group outline. | |
3364 */ | |
3365 HWND dw_groupbox_new(int type, int pad, char *title) | |
3366 { | |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3367 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3368 HWND hwndframe; |
3369 | |
3370 newbox->pad = pad; | |
3371 newbox->type = type; | |
3372 newbox->count = 0; | |
3373 | |
3374 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3375 WC_FRAME, | |
3376 NULL, | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3377 WS_VISIBLE | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3378 FS_NOBYTEALIGN, |
3 | 3379 0,0,2000,1000, |
3380 NULLHANDLE, | |
3381 HWND_TOP, | |
3382 0L, | |
3383 NULL, | |
3384 NULL); | |
3385 | |
3386 newbox->grouphwnd = WinCreateWindow(hwndframe, | |
3387 WC_STATIC, | |
3388 title, | |
3389 WS_VISIBLE | SS_GROUPBOX | | |
3390 WS_GROUP, | |
3391 0,0,2000,1000, | |
3392 NULLHANDLE, | |
3393 HWND_TOP, | |
3394 0L, | |
3395 NULL, | |
3396 NULL); | |
3397 | |
3398 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3399 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3400 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
3401 dw_window_set_font(newbox->grouphwnd, DefaultFont); | |
3402 return hwndframe; | |
3403 } | |
3404 | |
3405 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3406 * Create a new MDI Frame to be packed. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3407 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3408 * id: An ID to be used with dw_window_from_id or 0L. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3409 */ |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3410 HWND dw_mdi_new(unsigned long id) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3411 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3412 HWND hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3413 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3414 hwndframe = WinCreateWindow(HWND_OBJECT, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3415 WC_FRAME, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3416 NULL, |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3417 WS_VISIBLE | WS_CLIPCHILDREN | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
3418 FS_NOBYTEALIGN, |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3419 0,0,2000,1000, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3420 NULLHANDLE, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3421 HWND_TOP, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3422 0L, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3423 NULL, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3424 NULL); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3425 return hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3426 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3427 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3428 /* |
3 | 3429 * Create a bitmap object to be packed. |
3430 * Parameters: | |
3431 * id: An ID to be used with WinWindowFromID() or 0L. | |
3432 */ | |
3433 HWND dw_bitmap_new(ULONG id) | |
3434 { | |
3435 return WinCreateWindow(HWND_OBJECT, | |
3436 WC_STATIC, | |
3437 NULL, | |
3438 WS_VISIBLE | SS_TEXT, | |
3439 0,0,2000,1000, | |
3440 NULLHANDLE, | |
3441 HWND_TOP, | |
3442 id, | |
3443 NULL, | |
3444 NULL); | |
3445 } | |
3446 | |
3447 /* | |
3448 * Create a notebook object to be packed. | |
3449 * Parameters: | |
3450 * id: An ID to be used for getting the resource from the | |
3451 * resource file. | |
3452 */ | |
3453 HWND dw_notebook_new(ULONG id, int top) | |
3454 { | |
3455 ULONG flags; | |
3456 HWND tmp; | |
3457 | |
3458 if(top) | |
3459 flags = BKS_MAJORTABTOP; | |
3460 else | |
3461 flags = BKS_MAJORTABBOTTOM; | |
3462 | |
3463 tmp = WinCreateWindow(HWND_OBJECT, | |
3464 WC_NOTEBOOK, | |
3465 NULL, | |
3466 WS_VISIBLE | | |
3467 BKS_TABBEDDIALOG | | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3468 flags, |
3 | 3469 0,0,2000,1000, |
3470 NULLHANDLE, | |
3471 HWND_TOP, | |
3472 id, | |
3473 NULL, | |
3474 NULL); | |
3475 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3476 /* Fix tab sizes on Warp 3 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3477 if(!IS_WARP4()) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3478 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3479 /* best sizes to be determined by trial and error */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3480 WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB)); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3481 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3482 |
3 | 3483 dw_window_set_font(tmp, DefaultFont); |
3484 return tmp; | |
3485 } | |
3486 | |
3487 /* | |
3488 * Create a menu object to be popped up. | |
3489 * Parameters: | |
3490 * id: An ID to be used for getting the resource from the | |
3491 * resource file. | |
3492 */ | |
3493 HMENUI dw_menu_new(ULONG id) | |
3494 { | |
3495 HMENUI tmp = malloc(sizeof(struct _hmenui)); | |
3496 | |
3497 if(!tmp) | |
3498 return NULL; | |
3499 | |
3500 tmp->menu = WinCreateWindow(HWND_OBJECT, | |
3501 WC_MENU, | |
3502 NULL, | |
3503 WS_VISIBLE, | |
3504 0,0,2000,1000, | |
3505 NULLHANDLE, | |
3506 HWND_TOP, | |
3507 id, | |
3508 NULL, | |
3509 NULL); | |
3510 return tmp; | |
3511 } | |
3512 | |
3513 /* | |
3514 * Create a menubar on a window. | |
3515 * Parameters: | |
3516 * location: Handle of a window frame to be attached to. | |
3517 */ | |
3518 HMENUI dw_menubar_new(HWND location) | |
3519 { | |
3520 HMENUI tmp = malloc(sizeof(struct _hmenui)); | |
3521 | |
3522 if(!tmp) | |
3523 return NULL; | |
3524 | |
3525 tmp->menu = WinCreateWindow(location, | |
3526 WC_MENU, | |
3527 NULL, | |
3528 WS_VISIBLE | MS_ACTIONBAR, | |
3529 0,0,2000,1000, | |
3530 location, | |
3531 HWND_TOP, | |
3532 FID_MENU, | |
3533 NULL, | |
3534 NULL); | |
3535 return tmp; | |
3536 } | |
3537 | |
3538 /* | |
3539 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
3540 * Parameters: | |
3541 * menu: Handle of a menu. | |
3542 */ | |
3543 void dw_menu_destroy(HMENUI *menu) | |
3544 { | |
3545 if(menu && *menu) | |
3546 { | |
3547 WinDestroyWindow((*menu)->menu); | |
3548 free(*menu); | |
3549 *menu = NULL; | |
3550 } | |
3551 } | |
3552 | |
3553 /* | |
3554 * Adds a menuitem or submenu to an existing menu. | |
3555 * Parameters: | |
3556 * menu: The handle the the existing menu. | |
3557 * title: The title text on the menu item to be added. | |
3558 * id: An ID to be used for message passing. | |
3559 * flags: Extended attributes to set on the menu. | |
3560 * end: If TRUE memu is positioned at the end of the menu. | |
3561 * check: If TRUE menu is "check"able. | |
3562 * submenu: Handle to an existing menu to be a submenu or NULL. | |
3563 */ | |
3564 HWND dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) | |
3565 { | |
3566 MENUITEM miSubMenu; | |
3567 HWND menu; | |
3568 | |
3569 if(!menux) | |
3570 return NULLHANDLE; | |
3571 | |
3572 menu = menux->menu; | |
3573 | |
3574 if(end) | |
3575 miSubMenu.iPosition=MIT_END; | |
3576 else | |
3577 miSubMenu.iPosition=0; | |
3578 | |
3579 if(strlen(title) == 0) | |
3580 miSubMenu.afStyle=MIS_SEPARATOR | flags; | |
3581 else | |
3582 miSubMenu.afStyle=MIS_TEXT | flags; | |
3583 miSubMenu.afAttribute=0; | |
3584 miSubMenu.id=id; | |
3585 miSubMenu.hwndSubMenu = submenu ? submenu->menu : 0; | |
3586 miSubMenu.hItem=NULLHANDLE; | |
3587 | |
3588 WinSendMsg(menu, | |
3589 MM_INSERTITEM, | |
3590 MPFROMP(&miSubMenu), | |
3591 MPFROMP(title)); | |
3592 return (HWND)id; | |
3593 } | |
3594 | |
3595 /* | |
3596 * Sets the state of a menu item check. | |
3597 * Parameters: | |
3598 * menu: The handle the the existing menu. | |
3599 * id: Menuitem id. | |
3600 * check: TRUE for checked FALSE for not checked. | |
3601 */ | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
9
diff
changeset
|
3602 void dw_menu_item_set_check(HMENUI menux, unsigned long id, int check) |
3 | 3603 { |
3604 HWND menu; | |
3605 | |
3606 if(!menux) | |
3607 return; | |
3608 | |
3609 menu = menux->menu; | |
3610 | |
3611 if(check) | |
3612 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), | |
3613 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)); | |
3614 else | |
3615 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), | |
3616 MPFROM2SHORT(MIA_CHECKED, 0)); | |
3617 } | |
3618 | |
3619 /* | |
3620 * Pops up a context menu at given x and y coordinates. | |
3621 * Parameters: | |
3622 * menu: The handle the the existing menu. | |
3623 * parent: Handle to the window initiating the popup. | |
3624 * x: X coordinate. | |
3625 * y: Y coordinate. | |
3626 */ | |
3627 void dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) | |
3628 { | |
3629 if(menu && *menu) | |
3630 { | |
3631 WinPopupMenu(HWND_DESKTOP, parent, (*menu)->menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN); | |
3632 free(*menu); | |
3633 *menu = NULL; | |
3634 } | |
3635 } | |
3636 | |
3637 /* | |
3638 * Returns the current X and Y coordinates of the mouse pointer. | |
3639 * Parameters: | |
3640 * x: Pointer to variable to store X coordinate. | |
3641 * y: Pointer to variable to store Y coordinate. | |
3642 */ | |
3643 void dw_pointer_query_pos(long *x, long *y) | |
3644 { | |
3645 POINTL ptl; | |
3646 | |
3647 WinQueryPointerPos(HWND_DESKTOP, &ptl); | |
3648 if(x && y) | |
3649 { | |
3650 *x = ptl.x; | |
3651 *y = dw_screen_height() - ptl.y; | |
3652 } | |
3653 } | |
3654 | |
3655 /* | |
3656 * Sets the X and Y coordinates of the mouse pointer. | |
3657 * Parameters: | |
3658 * x: X coordinate. | |
3659 * y: Y coordinate. | |
3660 */ | |
3661 void dw_pointer_set_pos(long x, long y) | |
3662 { | |
3663 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y); | |
3664 } | |
3665 | |
3666 /* | |
3667 * Create a container object to be packed. | |
3668 * Parameters: | |
3669 * id: An ID to be used for getting the resource from the | |
3670 * resource file. | |
3671 */ | |
3672 HWND dw_container_new(ULONG id) | |
3673 { | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3674 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3675 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3676 WC_CONTAINER, | |
3677 NULL, | |
3678 WS_VISIBLE | CCS_READONLY | | |
3679 CCS_SINGLESEL | CCS_AUTOPOSITION, | |
3680 0,0,2000,1000, | |
3681 NULLHANDLE, | |
3682 HWND_TOP, | |
3683 id, | |
3684 NULL, | |
3685 NULL); | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3686 blah->oldproc = WinSubclassWindow(tmp, _TreeProc); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3687 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 3688 dw_window_set_font(tmp, DefaultFont); |
3689 return tmp; | |
3690 } | |
3691 | |
3692 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3693 * Create a tree object to be packed. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3694 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3695 * id: An ID to be used for getting the resource from the |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3696 * resource file. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3697 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3698 HWND dw_tree_new(ULONG id) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3699 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3700 CNRINFO cnrinfo; |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3701 WindowData *blah = calloc(1, sizeof(WindowData)); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3702 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3703 WC_CONTAINER, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3704 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3705 WS_VISIBLE | CCS_READONLY | |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3706 CCS_SINGLESEL | CCS_AUTOPOSITION, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3707 0,0,2000,1000, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3708 NULLHANDLE, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3709 HWND_TOP, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3710 id, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3711 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3712 NULL); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3713 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3714 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3715 cnrinfo.slBitmapOrIcon.cx = 16; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3716 cnrinfo.slBitmapOrIcon.cy = 16; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3717 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3718 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON)); |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3719 blah->oldproc = WinSubclassWindow(tmp, _TreeProc); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3720 WinSetWindowPtr(tmp, QWP_USER, blah); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3721 dw_window_set_font(tmp, DefaultFont); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3722 return tmp; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3723 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3724 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3725 /* |
3 | 3726 * Create a new static text window (widget) to be packed. |
3727 * Parameters: | |
3728 * text: The text to be display by the static text widget. | |
3729 * id: An ID to be used with WinWindowFromID() or 0L. | |
3730 */ | |
3731 HWND dw_text_new(char *text, ULONG id) | |
3732 { | |
3733 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
3734 WC_STATIC, | |
3735 text, | |
3736 WS_VISIBLE | SS_TEXT, | |
3737 0,0,2000,1000, | |
3738 NULLHANDLE, | |
3739 HWND_TOP, | |
3740 id, | |
3741 NULL, | |
3742 NULL); | |
3743 dw_window_set_font(tmp, DefaultFont); | |
3744 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
3745 return tmp; | |
3746 } | |
3747 | |
3748 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3749 * Create a new status text window (widget) to be packed. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3750 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3751 * text: The text to be display by the static text widget. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3752 * id: An ID to be used with WinWindowFromID() or 0L. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3753 */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3754 HWND dw_status_text_new(char *text, ULONG id) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3755 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3756 WindowData *blah = calloc(sizeof(WindowData), 1); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3757 HWND tmp = WinCreateWindow(HWND_OBJECT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3758 WC_STATIC, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3759 text, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3760 WS_VISIBLE | SS_TEXT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3761 0,0,2000,1000, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3762 NULLHANDLE, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3763 HWND_TOP, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3764 id, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3765 NULL, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3766 NULL); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3767 dw_window_set_font(tmp, DefaultFont); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3768 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3769 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3770 blah->oldproc = WinSubclassWindow(tmp, _statusproc); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3771 WinSetWindowPtr(tmp, QWP_USER, blah); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3772 return tmp; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3773 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3774 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3775 /* |
3 | 3776 * Create a new Multiline Editbox window (widget) to be packed. |
3777 * Parameters: | |
3778 * id: An ID to be used with WinWindowFromID() or 0L. | |
3779 */ | |
3780 HWND dw_mle_new(ULONG id) | |
3781 { | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3782 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3783 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3784 WC_MLE, | |
3785 "", | |
3786 WS_VISIBLE | | |
3787 MLS_BORDER | MLS_IGNORETAB | | |
3788 MLS_READONLY | MLS_VSCROLL, | |
3789 0,0,2000,1000, | |
3790 NULLHANDLE, | |
3791 HWND_TOP, | |
3792 id, | |
3793 NULL, | |
3794 NULL); | |
3795 dw_window_set_font(tmp, DefaultFont); | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3796 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3797 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 3798 return tmp; |
3799 } | |
3800 | |
3801 /* | |
3802 * Create a new Entryfield window (widget) to be packed. | |
3803 * Parameters: | |
3804 * text: The default text to be in the entryfield widget. | |
3805 * id: An ID to be used with WinWindowFromID() or 0L. | |
3806 */ | |
3807 HWND dw_entryfield_new(char *text, ULONG id) | |
3808 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3809 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3810 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3811 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3812 WC_ENTRYFIELD, | |
3813 text, | |
3814 WS_VISIBLE | ES_MARGIN | | |
3815 ES_AUTOSCROLL | WS_TABSTOP, | |
3816 0,0,2000,1000, | |
3817 NULLHANDLE, | |
3818 HWND_TOP, | |
3819 id, | |
3820 NULL, | |
3821 NULL); | |
3822 dw_window_set_font(tmp, DefaultFont); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3823 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 3824 WinSetWindowPtr(tmp, QWP_USER, blah); |
3825 return tmp; | |
3826 } | |
3827 | |
3828 /* | |
3829 * Create a new Entryfield (password) window (widget) to be packed. | |
3830 * Parameters: | |
3831 * text: The default text to be in the entryfield widget. | |
3832 * id: An ID to be used with WinWindowFromID() or 0L. | |
3833 */ | |
3834 HWND dw_entryfield_password_new(char *text, ULONG id) | |
3835 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3836 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3837 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3838 WC_ENTRYFIELD, | |
3839 text, | |
3840 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE | | |
3841 ES_AUTOSCROLL | WS_TABSTOP, | |
3842 0,0,2000,1000, | |
3843 NULLHANDLE, | |
3844 HWND_TOP, | |
3845 id, | |
3846 NULL, | |
3847 NULL); | |
3848 dw_window_set_font(tmp, DefaultFont); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3849 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 3850 WinSetWindowPtr(tmp, QWP_USER, blah); |
3851 return tmp; | |
3852 } | |
3853 | |
3854 /* | |
3855 * Create a new Combobox window (widget) to be packed. | |
3856 * Parameters: | |
3857 * text: The default text to be in the combpbox widget. | |
3858 * id: An ID to be used with WinWindowFromID() or 0L. | |
3859 */ | |
3860 HWND dw_combobox_new(char *text, ULONG id) | |
3861 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3862 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3863 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3864 WC_COMBOBOX, | |
3865 text, | |
3866 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, | |
3867 0,0,2000,1000, | |
3868 NULLHANDLE, | |
3869 HWND_TOP, | |
3870 id, | |
3871 NULL, | |
3872 NULL); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3873 HENUM henum = WinBeginEnumWindows(tmp); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3874 HWND child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3875 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3876 while((child = WinGetNextWindow(henum)) != NULLHANDLE) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3877 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3878 WindowData *moreblah = calloc(1, sizeof(WindowData)); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3879 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3880 WinSetWindowPtr(child, QWP_USER, moreblah); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3881 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3882 WinEndEnumWindows(henum); |
3 | 3883 dw_window_set_font(tmp, DefaultFont); |
3884 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3885 blah->oldproc = WinSubclassWindow(tmp, _comboproc); |
3 | 3886 WinSetWindowPtr(tmp, QWP_USER, blah); |
3887 return tmp; | |
3888 } | |
3889 | |
3890 /* | |
3891 * Create a new button window (widget) to be packed. | |
3892 * Parameters: | |
3893 * text: The text to be display by the static text widget. | |
3894 * id: An ID to be used with WinWindowFromID() or 0L. | |
3895 */ | |
3896 HWND dw_button_new(char *text, ULONG id) | |
3897 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3898 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 3899 |
3900 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
3901 WC_BUTTON, | |
3902 text, | |
3903 WS_VISIBLE, | |
3904 0,0,2000,1000, | |
3905 NULLHANDLE, | |
3906 HWND_TOP, | |
3907 id, | |
3908 NULL, | |
3909 NULL); | |
3910 | |
3911 bubble->id = id; | |
3912 bubble->bubbletext[0] = '\0'; | |
3913 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
3914 | |
3915 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
3916 dw_window_set_font(tmp, DefaultFont); | |
3917 return tmp; | |
3918 } | |
3919 | |
3920 /* Function: GenResIDStr | |
3921 ** Abstract: Generate string '#nnnn' for a given ID for using with Button | |
3922 ** controls | |
3923 */ | |
3924 | |
3925 void _GenResIDStr(CHAR *buff, ULONG ulID) | |
3926 { | |
3927 char *str; | |
3928 int slen = 0; | |
3929 | |
3930 *buff++ = '#'; | |
3931 | |
3932 str = buff; | |
3933 | |
3934 do | |
3935 { | |
3936 *str++ = (ulID % 10) + '0'; | |
3937 ulID /= 10; | |
3938 slen++; | |
3939 } | |
3940 while(ulID); | |
3941 | |
3942 *str-- = 0; | |
3943 | |
3944 for(; str > buff; str--, buff++) | |
3945 { | |
3946 *buff ^= *str; | |
3947 *str ^= *buff; | |
3948 *buff ^= *str; | |
3949 } | |
3950 } | |
3951 | |
3952 | |
3953 /* | |
3954 * Create a new bitmap button window (widget) to be packed. | |
3955 * Parameters: | |
3956 * text: Bubble help text to be displayed. | |
3957 * id: An ID of a bitmap in the resource file. | |
3958 */ | |
3959 HWND dw_bitmapbutton_new(char *text, ULONG id) | |
3960 { | |
3961 char idbuf[256]; | |
3962 HWND tmp; | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3963 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 3964 |
3965 _GenResIDStr(idbuf, id); | |
3966 | |
3967 tmp = WinCreateWindow(HWND_OBJECT, | |
3968 WC_BUTTON, | |
3969 idbuf, | |
3970 WS_VISIBLE | BS_PUSHBUTTON | | |
3971 BS_BITMAP | BS_AUTOSIZE | | |
3972 BS_NOPOINTERFOCUS, | |
3973 0,0,2000,1000, | |
3974 NULLHANDLE, | |
3975 HWND_TOP, | |
3976 id, | |
3977 NULL, | |
3978 NULL); | |
3979 | |
3980 bubble->id = id; | |
3981 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | |
3982 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
3983 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
3984 | |
3985 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
3986 return tmp; | |
3987 } | |
3988 | |
3989 /* | |
3990 * Create a new spinbutton window (widget) to be packed. | |
3991 * Parameters: | |
3992 * text: The text to be display by the static text widget. | |
3993 * id: An ID to be used with WinWindowFromID() or 0L. | |
3994 */ | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3995 HWND dw_spinbutton_new(char *text, ULONG id) |
3 | 3996 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3997 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 3998 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3999 WC_SPINBUTTON, | |
4000 text, | |
4001 WS_VISIBLE | SPBS_MASTER, | |
4002 0,0,2000,1000, | |
4003 NULLHANDLE, | |
4004 HWND_TOP, | |
4005 id, | |
4006 NULL, | |
4007 NULL); | |
4008 dw_window_set_font(tmp, DefaultFont); | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4009 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4010 WinSetWindowPtr(tmp, QWP_USER, blah); |
4011 return tmp; | |
4012 } | |
4013 | |
4014 /* | |
4015 * Create a new radiobutton window (widget) to be packed. | |
4016 * Parameters: | |
4017 * text: The text to be display by the static text widget. | |
4018 * id: An ID to be used with WinWindowFromID() or 0L. | |
4019 */ | |
4020 HWND dw_radiobutton_new(char *text, ULONG id) | |
4021 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4022 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4023 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4024 WC_BUTTON, | |
4025 text, | |
4026 WS_VISIBLE | | |
4027 BS_AUTORADIOBUTTON, | |
4028 0,0,2000,1000, | |
4029 NULLHANDLE, | |
4030 HWND_TOP, | |
4031 id, | |
4032 NULL, | |
4033 NULL); | |
4034 dw_window_set_font(tmp, DefaultFont); | |
4035 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4036 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4037 WinSetWindowPtr(tmp, QWP_USER, blah); |
4038 return tmp; | |
4039 } | |
4040 | |
4041 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4042 * Create a new slider window (widget) to be packed. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4043 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4044 * vertical: TRUE or FALSE if slider is vertical. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4045 * increments: Number of increments available. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4046 * id: An ID to be used with WinWindowFromID() or 0L. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4047 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4048 HWND dw_slider_new(int vertical, int increments, ULONG id) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4049 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4050 WindowData *blah = calloc(1, sizeof(WindowData)); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4051 SLDCDATA sldcData = { sizeof(SLDCDATA), increments, 0, 0, 0 }; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4052 HWND tmp = WinCreateWindow(HWND_OBJECT, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4053 WC_SLIDER, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4054 "", |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4055 WS_VISIBLE | SLS_SNAPTOINCREMENT | |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4056 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4057 0,0,2000,1000, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4058 NULLHANDLE, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4059 HWND_TOP, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4060 id, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4061 &sldcData, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4062 NULL); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4063 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4064 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4065 WinSetWindowPtr(tmp, QWP_USER, blah); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4066 return tmp; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4067 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4068 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4069 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4070 * Create a new percent bar window (widget) to be packed. |
3 | 4071 * Parameters: |
4072 * id: An ID to be used with WinWindowFromID() or 0L. | |
4073 */ | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4074 HWND dw_percent_new(ULONG id) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4075 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4076 HWND tmp = WinCreateWindow(HWND_OBJECT, |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4077 WC_SLIDER, |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4078 "", |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4079 WS_VISIBLE | SLS_READONLY |
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4080 | SLS_RIBBONSTRIP, |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4081 0,0,2000,1000, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4082 NULLHANDLE, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4083 HWND_TOP, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4084 id, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4085 NULL, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4086 NULL); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4087 dw_window_disable(tmp); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4088 return tmp; |
3 | 4089 } |
4090 | |
4091 /* | |
4092 * Create a new checkbox window (widget) to be packed. | |
4093 * Parameters: | |
4094 * text: The text to be display by the static text widget. | |
4095 * id: An ID to be used with WinWindowFromID() or 0L. | |
4096 */ | |
4097 HWND dw_checkbox_new(char *text, ULONG id) | |
4098 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4099 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4100 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4101 WC_BUTTON, | |
4102 text, | |
4103 WS_VISIBLE | BS_AUTOCHECKBOX, | |
4104 0,0,2000,1000, | |
4105 NULLHANDLE, | |
4106 HWND_TOP, | |
4107 id, | |
4108 NULL, | |
4109 NULL); | |
4110 dw_window_set_font(tmp, DefaultFont); | |
4111 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4112 bubble->id = id; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4113 bubble->bubbletext[0] = '\0'; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4114 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4115 WinSetWindowPtr(tmp, QWP_USER, bubble); |
3 | 4116 return tmp; |
4117 } | |
4118 | |
4119 /* | |
4120 * Create a new listbox window (widget) to be packed. | |
4121 * Parameters: | |
4122 * id: An ID to be used with WinWindowFromID() or 0L. | |
4123 * multi: Multiple select TRUE or FALSE. | |
4124 */ | |
4125 HWND dw_listbox_new(ULONG id, int multi) | |
4126 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4127 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4128 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4129 WC_LISTBOX, | |
4130 NULL, | |
4131 WS_VISIBLE | LS_NOADJUSTPOS | | |
4132 (multi ? LS_MULTIPLESEL : 0), | |
4133 0,0,2000,1000, | |
4134 NULLHANDLE, | |
4135 HWND_TOP, | |
4136 id, | |
4137 NULL, | |
4138 NULL); | |
4139 dw_window_set_font(tmp, DefaultFont); | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4140 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4141 WinSetWindowPtr(tmp, QWP_USER, blah); |
4142 return tmp; | |
4143 } | |
4144 | |
4145 /* | |
4146 * Sets the icon used for a given window. | |
4147 * Parameters: | |
4148 * handle: Handle to the window. | |
4149 * id: An ID to be used to specify the icon. | |
4150 */ | |
4151 void dw_window_set_icon(HWND handle, ULONG id) | |
4152 { | |
4153 HPOINTER icon; | |
4154 | |
4155 icon = WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id); | |
4156 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0); | |
4157 } | |
4158 | |
4159 /* | |
4160 * Sets the bitmap used for a given static window. | |
4161 * Parameters: | |
4162 * handle: Handle to the window. | |
4163 * id: An ID to be used to specify the icon. | |
4164 */ | |
4165 void dw_window_set_bitmap(HWND handle, ULONG id) | |
4166 { | |
4167 HBITMAP hbm; | |
4168 HPS hps = WinGetPS(handle); | |
4169 | |
4170 hbm = GpiLoadBitmap(hps, NULLHANDLE, id, 0, 0); | |
4171 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f); | |
4172 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL ); | |
4173 /*WinSetWindowULong( hwndDlg, QWL_USER, (ULONG) hbm );*/ | |
4174 WinReleasePS(hps); | |
4175 } | |
4176 | |
4177 /* | |
4178 * Sets the text used for a given window. | |
4179 * Parameters: | |
4180 * handle: Handle to the window. | |
4181 * text: The text associsated with a given window. | |
4182 */ | |
4183 void dw_window_set_text(HWND handle, char *text) | |
4184 { | |
4185 WinSetWindowText(handle, text); | |
4186 } | |
4187 | |
4188 /* | |
4189 * Gets the text used for a given window. | |
4190 * Parameters: | |
4191 * handle: Handle to the window. | |
4192 * Returns: | |
4193 * text: The text associsated with a given window. | |
4194 */ | |
4195 char *dw_window_get_text(HWND handle) | |
4196 { | |
4197 char tempbuf[4096] = ""; | |
4198 | |
4199 WinQueryWindowText(handle, 4095, tempbuf); | |
4200 tempbuf[4095] = 0; | |
4201 | |
4202 return strdup(tempbuf); | |
4203 } | |
4204 | |
4205 /* | |
4206 * Disables given window (widget). | |
4207 * Parameters: | |
4208 * handle: Handle to the window. | |
4209 */ | |
4210 void dw_window_disable(HWND handle) | |
4211 { | |
4212 WinEnableWindow(handle, FALSE); | |
4213 } | |
4214 | |
4215 /* | |
4216 * Enables given window (widget). | |
4217 * Parameters: | |
4218 * handle: Handle to the window. | |
4219 */ | |
4220 void dw_window_enable(HWND handle) | |
4221 { | |
4222 WinEnableWindow(handle, TRUE); | |
4223 } | |
4224 | |
4225 /* | |
4226 * Gets the child window handle with specified ID. | |
4227 * Parameters: | |
4228 * handle: Handle to the parent window. | |
4229 * id: Integer ID of the child. | |
4230 */ | |
4231 HWND dw_window_from_id(HWND handle, int id) | |
4232 { | |
4233 HENUM henum; | |
4234 HWND child; | |
4235 char tmpbuf[100]; | |
4236 | |
4237 henum = WinBeginEnumWindows(handle); | |
4238 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
4239 { | |
4240 int windowid = WinQueryWindowUShort(child, QWS_ID); | |
4241 HWND found; | |
4242 | |
4243 WinQueryClassName(child, 99, tmpbuf); | |
4244 | |
4245 /* If the child is a box (frame) then recurse into it */ | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4246 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 4247 if((found = dw_window_from_id(child, id)) != NULLHANDLE) |
4248 return found; | |
4249 | |
4250 if(windowid && windowid == id) | |
4251 { | |
4252 WinEndEnumWindows(henum); | |
4253 return child; | |
4254 } | |
4255 } | |
4256 WinEndEnumWindows(henum); | |
4257 return NULLHANDLE; | |
4258 } | |
4259 | |
4260 /* | |
4261 * Pack windows (widgets) into a box from the end (or bottom). | |
4262 * Parameters: | |
4263 * box: Window handle of the box to be packed into. | |
4264 * item: Window handle of the item to be back. | |
4265 * width: Width in pixels of the item or -1 to be self determined. | |
4266 * height: Height in pixels of the item or -1 to be self determined. | |
4267 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
4268 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
4269 * pad: Number of pixels of padding around the item. | |
4270 */ | |
4271 void dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
4272 { | |
4273 Box *thisbox; | |
4274 | |
4275 if(WinWindowFromID(box, FID_CLIENT)) | |
4276 { | |
4277 box = WinWindowFromID(box, FID_CLIENT); | |
4278 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4279 } | |
4280 else | |
4281 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4282 if(thisbox) | |
4283 { | |
4284 if(thisbox->type == BOXHORZ) | |
4285 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); | |
4286 else | |
4287 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); | |
4288 } | |
4289 } | |
4290 | |
4291 void dw_box_pack_end_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
4292 { | |
4293 Box *thisbox; | |
4294 | |
4295 if(WinWindowFromID(box, FID_CLIENT)) | |
4296 { | |
4297 box = WinWindowFromID(box, FID_CLIENT); | |
4298 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4299 hsize = TRUE; | |
4300 vsize = TRUE; | |
4301 } | |
4302 else | |
4303 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4304 if(!thisbox) | |
4305 { | |
4306 box = WinWindowFromID(box, FID_CLIENT); | |
4307 if(box) | |
4308 { | |
4309 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4310 hsize = TRUE; | |
4311 vsize = TRUE; | |
4312 } | |
4313 } | |
4314 if(thisbox) | |
4315 { | |
4316 int z; | |
4317 Item *tmpitem, *thisitem = thisbox->items; | |
4318 char tmpbuf[100]; | |
4319 | |
4320 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
4321 | |
4322 for(z=0;z<thisbox->count;z++) | |
4323 { | |
4324 tmpitem[z] = thisitem[z]; | |
4325 } | |
4326 | |
4327 WinQueryClassName(item, 99, tmpbuf); | |
4328 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4329 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 4330 tmpitem[thisbox->count].type = TYPEBOX; |
4331 else | |
4332 tmpitem[thisbox->count].type = TYPEITEM; | |
4333 | |
4334 tmpitem[thisbox->count].hwnd = item; | |
4335 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width; | |
4336 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height; | |
4337 tmpitem[thisbox->count].pad = pad; | |
4338 if(hsize) | |
4339 tmpitem[thisbox->count].hsize = SIZEEXPAND; | |
4340 else | |
4341 tmpitem[thisbox->count].hsize = SIZESTATIC; | |
4342 | |
4343 if(vsize) | |
4344 tmpitem[thisbox->count].vsize = SIZEEXPAND; | |
4345 else | |
4346 tmpitem[thisbox->count].vsize = SIZESTATIC; | |
4347 | |
4348 thisbox->items = tmpitem; | |
4349 | |
4350 if(thisbox->count) | |
4351 free(thisitem); | |
4352 | |
4353 thisbox->count++; | |
4354 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4355 /* Don't set the ownership if it's an entryfield or spinbutton */ |
3 | 4356 WinQueryClassName(item, 99, tmpbuf); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4357 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4358 WinSetOwner(item, box); |
3 | 4359 WinSetParent(item, box, FALSE); |
4360 } | |
4361 } | |
4362 | |
4363 /* | |
4364 * Sets the size of a given window (widget). | |
4365 * Parameters: | |
4366 * handle: Window (widget) handle. | |
4367 * width: New width in pixels. | |
4368 * height: New height in pixels. | |
4369 */ | |
4370 void dw_window_set_usize(HWND handle, ULONG width, ULONG height) | |
4371 { | |
4372 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); | |
4373 } | |
4374 | |
4375 /* | |
4376 * Returns the width of the screen. | |
4377 */ | |
4378 int dw_screen_width(void) | |
4379 { | |
4380 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); | |
4381 } | |
4382 | |
4383 /* | |
4384 * Returns the height of the screen. | |
4385 */ | |
4386 int dw_screen_height(void) | |
4387 { | |
4388 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); | |
4389 } | |
4390 | |
4391 /* This should return the current color depth */ | |
4392 unsigned long dw_color_depth(void) | |
4393 { | |
4394 HDC hdc = WinOpenWindowDC(HWND_DESKTOP); | |
4395 long colors; | |
4396 | |
4397 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); | |
4398 DevCloseDC(hdc); | |
4399 return colors; | |
4400 } | |
4401 | |
4402 | |
4403 /* | |
4404 * Sets the position of a given window (widget). | |
4405 * Parameters: | |
4406 * handle: Window (widget) handle. | |
4407 * x: X location from the bottom left. | |
4408 * y: Y location from the bottom left. | |
4409 */ | |
4410 void dw_window_set_pos(HWND handle, ULONG x, ULONG y) | |
4411 { | |
4412 int myy = _get_frame_height(handle) - (y + _get_height(handle)); | |
4413 | |
4414 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE); | |
4415 } | |
4416 | |
4417 /* | |
4418 * Sets the position and size of a given window (widget). | |
4419 * Parameters: | |
4420 * handle: Window (widget) handle. | |
4421 * x: X location from the bottom left. | |
4422 * y: Y location from the bottom left. | |
4423 * width: Width of the widget. | |
4424 * height: Height of the widget. | |
4425 */ | |
4426 void dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) | |
4427 { | |
4428 int myy = _get_frame_height(handle) - (y + height); | |
4429 | |
4430 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); | |
4431 } | |
4432 | |
4433 /* | |
4434 * Gets the position and size of a given window (widget). | |
4435 * Parameters: | |
4436 * handle: Window (widget) handle. | |
4437 * x: X location from the bottom left. | |
4438 * y: Y location from the bottom left. | |
4439 * width: Width of the widget. | |
4440 * height: Height of the widget. | |
4441 */ | |
4442 void dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) | |
4443 { | |
4444 SWP swp; | |
4445 WinQueryWindowPos(handle, &swp); | |
4446 if(x) | |
4447 *x = swp.x; | |
4448 if(y) | |
4449 *y = _get_frame_height(handle) - (swp.y + swp.cy); | |
4450 if(width) | |
4451 *width = swp.cx; | |
4452 if(height) | |
4453 *height = swp.cy; | |
4454 } | |
4455 | |
4456 /* | |
4457 * Sets the style of a given window (widget). | |
4458 * Parameters: | |
4459 * handle: Window (widget) handle. | |
4460 * width: New width in pixels. | |
4461 * height: New height in pixels. | |
4462 */ | |
4463 void dw_window_set_style(HWND handle, ULONG style, ULONG mask) | |
4464 { | |
4465 WinSetWindowBits(handle, QWL_STYLE, style, mask); | |
4466 } | |
4467 | |
4468 /* | |
4469 * Adds a new page to specified notebook. | |
4470 * Parameters: | |
4471 * handle: Window (widget) handle. | |
4472 * flags: Any additional page creation flags. | |
4473 * front: If TRUE page is added at the beginning. | |
4474 */ | |
4475 ULONG dw_notebook_page_new(HWND handle, ULONG flags, int front) | |
4476 { | |
4477 if(front) | |
4478 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
4479 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_FIRST)); | |
4480 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
4481 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_LAST)); | |
4482 } | |
4483 | |
4484 /* | |
4485 * Remove a page from a notebook. | |
4486 * Parameters: | |
4487 * handle: Handle to the notebook widget. | |
4488 * pageid: ID of the page to be destroyed. | |
4489 */ | |
4490 void dw_notebook_page_destroy(HWND handle, unsigned int pageid) | |
4491 { | |
4492 WinSendMsg(handle, BKM_DELETEPAGE, | |
4493 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE); | |
4494 } | |
4495 | |
4496 /* | |
4497 * Queries the currently visible page ID. | |
4498 * Parameters: | |
4499 * handle: Handle to the notebook widget. | |
4500 */ | |
4501 unsigned int dw_notebook_page_query(HWND handle) | |
4502 { | |
4503 return (int)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR)); | |
4504 } | |
4505 | |
4506 /* | |
4507 * Sets the currently visibale page ID. | |
4508 * Parameters: | |
4509 * handle: Handle to the notebook widget. | |
4510 * pageid: ID of the page to be made visible. | |
4511 */ | |
4512 void dw_notebook_page_set(HWND handle, unsigned int pageid) | |
4513 { | |
4514 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L); | |
4515 } | |
4516 | |
4517 /* | |
4518 * Sets the text on the specified notebook tab. | |
4519 * Parameters: | |
4520 * handle: Notebook handle. | |
4521 * pageid: Page ID of the tab to set. | |
4522 * text: Pointer to the text to set. | |
4523 */ | |
4524 void dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) | |
4525 { | |
4526 WinSendMsg(handle, BKM_SETTABTEXT, | |
4527 MPFROMLONG(pageid), MPFROMP(text)); | |
4528 } | |
4529 | |
4530 /* | |
4531 * Sets the text on the specified notebook tab status area. | |
4532 * Parameters: | |
4533 * handle: Notebook handle. | |
4534 * pageid: Page ID of the tab to set. | |
4535 * text: Pointer to the text to set. | |
4536 */ | |
4537 void dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) | |
4538 { | |
4539 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, | |
4540 MPFROMLONG(pageid), MPFROMP(text)); | |
4541 } | |
4542 | |
4543 /* | |
4544 * Packs the specified box into the notebook page. | |
4545 * Parameters: | |
4546 * handle: Handle to the notebook to be packed. | |
4547 * pageid: Page ID in the notebook which is being packed. | |
4548 * page: Box handle to be packed. | |
4549 */ | |
4550 void dw_notebook_pack(HWND handle, ULONG pageid, HWND page) | |
4551 { | |
4552 HWND tmpbox = dw_box_new(BOXVERT, 0); | |
4553 | |
4554 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | |
4555 WinSubclassWindow(tmpbox, _wndproc); | |
4556 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, | |
4557 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); | |
4558 } | |
4559 | |
4560 /* | |
4561 * Appends the specified text to the listbox's (or combobox) entry list. | |
4562 * Parameters: | |
4563 * handle: Handle to the listbox to be appended to. | |
4564 * text: Text to append into listbox. | |
4565 */ | |
4566 void dw_listbox_append(HWND handle, char *text) | |
4567 { | |
4568 WinSendMsg(handle, | |
4569 LM_INSERTITEM, | |
4570 MPFROMSHORT(LIT_END), | |
4571 MPFROMP(text)); | |
4572 } | |
4573 | |
4574 /* | |
4575 * Clears the listbox's (or combobox) list of all entries. | |
4576 * Parameters: | |
4577 * handle: Handle to the listbox to be cleared. | |
4578 */ | |
4579 void dw_listbox_clear(HWND handle) | |
4580 { | |
4581 WinSendMsg(handle, | |
4582 LM_DELETEALL, 0L, 0L); | |
4583 } | |
4584 | |
4585 /* | |
4586 * Returns the listbox's item count. | |
4587 * Parameters: | |
4588 * handle: Handle to the listbox to be cleared. | |
4589 */ | |
4590 int dw_listbox_count(HWND handle) | |
4591 { | |
4592 return (int)WinSendMsg(handle, | |
4593 LM_QUERYITEMCOUNT,0L, 0L); | |
4594 } | |
4595 | |
4596 /* | |
4597 * Sets the topmost item in the viewport. | |
4598 * Parameters: | |
4599 * handle: Handle to the listbox to be cleared. | |
4600 * top: Index to the top item. | |
4601 */ | |
4602 void dw_listbox_set_top(HWND handle, int top) | |
4603 { | |
4604 WinSendMsg(handle, | |
4605 LM_SETTOPINDEX, | |
4606 MPFROMSHORT(top), | |
4607 0L); | |
4608 } | |
4609 | |
4610 /* | |
4611 * Copies the given index item's text into buffer. | |
4612 * Parameters: | |
4613 * handle: Handle to the listbox to be queried. | |
4614 * index: Index into the list to be queried. | |
4615 * buffer: Buffer where text will be copied. | |
4616 * length: Length of the buffer (including NULL). | |
4617 */ | |
4618 void dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) | |
4619 { | |
4620 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer); | |
4621 } | |
4622 | |
4623 /* | |
4624 * Sets the text of a given listbox entry. | |
4625 * Parameters: | |
4626 * handle: Handle to the listbox to be queried. | |
4627 * index: Index into the list to be queried. | |
4628 * buffer: Buffer where text will be copied. | |
4629 */ | |
4630 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) | |
4631 { | |
4632 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); | |
4633 } | |
4634 | |
4635 /* | |
4636 * Returns the index to the item in the list currently selected. | |
4637 * Parameters: | |
4638 * handle: Handle to the listbox to be queried. | |
4639 */ | |
4640 unsigned int dw_listbox_selected(HWND handle) | |
4641 { | |
4642 return (unsigned int)WinSendMsg(handle, | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
4643 LM_QUERYSELECTION, |
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
4644 MPFROMSHORT(LIT_CURSOR), |
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
4645 0); |
3 | 4646 } |
4647 | |
4648 /* | |
4649 * Returns the index to the current selected item or -1 when done. | |
4650 * Parameters: | |
4651 * handle: Handle to the listbox to be queried. | |
4652 * where: Either the previous return or -1 to restart. | |
4653 */ | |
4654 int dw_listbox_selected_multi(HWND handle, int where) | |
4655 { | |
4656 int place = where; | |
4657 | |
4658 if(where == -1) | |
4659 place = LIT_FIRST; | |
4660 | |
4661 place = (int)WinSendMsg(handle, | |
4662 LM_QUERYSELECTION, | |
4663 MPFROMSHORT(place),0L); | |
4664 if(place == LIT_NONE) | |
4665 return -1; | |
4666 return place; | |
4667 } | |
4668 | |
4669 /* | |
4670 * Sets the selection state of a given index. | |
4671 * Parameters: | |
4672 * handle: Handle to the listbox to be set. | |
4673 * index: Item index. | |
4674 * state: TRUE if selected FALSE if unselected. | |
4675 */ | |
4676 void dw_listbox_select(HWND handle, int index, int state) | |
4677 { | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4678 char tmpbuf[100]; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4679 |
3 | 4680 WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4681 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4682 WinQueryClassName(handle, 99, tmpbuf); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4683 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4684 /* If we are setting a combobox call the event handler manually */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4685 if(strncmp(tmpbuf, "#6", 3)==0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4686 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); |
3 | 4687 } |
4688 | |
4689 /* | |
4690 * Deletes the item with given index from the list. | |
4691 * Parameters: | |
4692 * handle: Handle to the listbox to be set. | |
4693 * index: Item index. | |
4694 */ | |
4695 void dw_listbox_delete(HWND handle, int index) | |
4696 { | |
4697 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0); | |
4698 } | |
4699 | |
4700 /* | |
4701 * Adds text to an MLE box and returns the current point. | |
4702 * Parameters: | |
4703 * handle: Handle to the MLE to be queried. | |
4704 * buffer: Text buffer to be imported. | |
4705 * startpoint: Point to start entering text. | |
4706 */ | |
4707 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint) | |
4708 { | |
4709 unsigned long point = startpoint; | |
4710 PBYTE mlebuf; | |
4711 | |
4712 /* Work around 64K limit */ | |
4713 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
4714 { | |
4715 int amount, len = strlen(buffer), written = 0; | |
4716 | |
4717 while(written < len) | |
4718 { | |
4719 if((len - written) > 65535) | |
4720 amount = 65535; | |
4721 else | |
4722 amount = len - written; | |
4723 | |
4724 memcpy(mlebuf, &buffer[written], amount); | |
4725 mlebuf[amount] = '\0'; | |
4726 | |
4727 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1)); | |
4728 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); | |
4729 dw_mle_delete(handle, point, 1); | |
4730 | |
4731 written += amount; | |
4732 } | |
4733 DosFreeMem(mlebuf); | |
4734 } | |
4735 return point - 1; | |
4736 } | |
4737 | |
4738 /* | |
4739 * Grabs text from an MLE box. | |
4740 * Parameters: | |
4741 * handle: Handle to the MLE to be queried. | |
4742 * buffer: Text buffer to be exported. | |
4743 * startpoint: Point to start grabbing text. | |
4744 * length: Amount of text to be grabbed. | |
4745 */ | |
4746 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length) | |
4747 { | |
4748 PBYTE mlebuf; | |
4749 | |
4750 /* Work around 64K limit */ | |
4751 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
4752 { | |
4753 int amount, copied, written = 0; | |
4754 | |
4755 while(written < length) | |
4756 { | |
4757 if((length - written) > 65535) | |
4758 amount = 65535; | |
4759 else | |
4760 amount = length - written; | |
4761 | |
4762 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount)); | |
4763 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount)); | |
4764 | |
4765 if(copied) | |
4766 { | |
4767 memcpy(&buffer[written], mlebuf, copied); | |
4768 | |
4769 written += copied; | |
4770 } | |
4771 else | |
4772 break; | |
4773 } | |
4774 DosFreeMem(mlebuf); | |
4775 } | |
4776 } | |
4777 | |
4778 /* | |
4779 * Obtains information about an MLE box. | |
4780 * Parameters: | |
4781 * handle: Handle to the MLE to be queried. | |
4782 * bytes: A pointer to a variable to return the total bytes. | |
4783 * lines: A pointer to a variable to return the number of lines. | |
4784 */ | |
4785 void dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines) | |
4786 { | |
4787 if(bytes) | |
4788 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0); | |
4789 if(lines) | |
4790 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0); | |
4791 } | |
4792 | |
4793 /* | |
4794 * Deletes text from an MLE box. | |
4795 * Parameters: | |
4796 * handle: Handle to the MLE to be deleted from. | |
4797 * startpoint: Point to start deleting text. | |
4798 * length: Amount of text to be deleted. | |
4799 */ | |
4800 void dw_mle_delete(HWND handle, int startpoint, int length) | |
4801 { | |
4802 char *buf = malloc(length+1); | |
4803 int z, dellen = length; | |
4804 | |
4805 dw_mle_export(handle, buf, startpoint, length); | |
4806 | |
4807 for(z=0;z<length-1;z++) | |
4808 { | |
4809 if(strncmp(&buf[z], "\r\n", 2) == 0) | |
4810 dellen--; | |
4811 } | |
4812 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen)); | |
4813 free(buf); | |
4814 } | |
4815 | |
4816 /* | |
4817 * Clears all text from an MLE box. | |
4818 * Parameters: | |
4819 * handle: Handle to the MLE to be cleared. | |
4820 */ | |
4821 void dw_mle_clear(HWND handle) | |
4822 { | |
4823 unsigned long bytes; | |
4824 | |
4825 dw_mle_query(handle, &bytes, NULL); | |
4826 | |
4827 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes)); | |
4828 } | |
4829 | |
4830 /* | |
4831 * Sets the visible line of an MLE box. | |
4832 * Parameters: | |
4833 * handle: Handle to the MLE to be positioned. | |
4834 * line: Line to be visible. | |
4835 */ | |
4836 void dw_mle_set_visible(HWND handle, int line) | |
4837 { | |
4838 int tmppnt; | |
4839 | |
4840 if(line > 10) | |
4841 { | |
4842 tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line - 10), 0); | |
4843 WinSendMsg(handle, MLM_SETFIRSTCHAR, MPFROMLONG(tmppnt), 0); | |
4844 } | |
4845 } | |
4846 | |
4847 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4848 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4849 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4850 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4851 * state: TRUE if it can be edited, FALSE for readonly. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4852 */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4853 void dw_mle_set_editable(HWND handle, int state) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4854 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4855 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4856 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4857 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4858 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4859 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4860 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4861 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4862 * state: TRUE if it wraps, FALSE if it doesn't. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4863 */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4864 void dw_mle_set_word_wrap(HWND handle, int state) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4865 { |
16
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
4866 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4867 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4868 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4869 /* |
3 | 4870 * Sets the current cursor position of an MLE box. |
4871 * Parameters: | |
4872 * handle: Handle to the MLE to be positioned. | |
4873 * point: Point to position cursor. | |
4874 */ | |
4875 void dw_mle_set(HWND handle, int point) | |
4876 { | |
4877 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point)); | |
4878 } | |
4879 | |
4880 /* | |
4881 * Finds text in an MLE box. | |
4882 * Parameters: | |
4883 * handle: Handle to the MLE to be cleared. | |
4884 * text: Text to search for. | |
4885 * point: Start point of search. | |
4886 * flags: Search specific flags. | |
4887 */ | |
4888 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags) | |
4889 { | |
4890 MLE_SEARCHDATA msd; | |
4891 | |
16
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
4892 /* This code breaks with structure packing set to 1 (/Sp1 in VAC) |
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
4893 * if this is needed we need to add a pragma here. |
ca7a8215487a
Removed structure packing option to fix a crash in dw_mle_search() when
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
15
diff
changeset
|
4894 */ |
3 | 4895 msd.cb = sizeof(msd); |
4896 msd.pchFind = text; | |
4897 msd.pchReplace = NULL; | |
4898 msd.cchFind = strlen(text); | |
4899 msd.cchReplace = 0; | |
4900 msd.iptStart = point; | |
4901 msd.iptStop = -1; | |
4902 | |
4903 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd)) | |
4904 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0); | |
4905 return 0; | |
4906 } | |
4907 | |
4908 /* | |
4909 * Stops redrawing of an MLE box. | |
4910 * Parameters: | |
4911 * handle: Handle to the MLE to freeze. | |
4912 */ | |
4913 void dw_mle_freeze(HWND handle) | |
4914 { | |
4915 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0); | |
4916 } | |
4917 | |
4918 /* | |
4919 * Resumes redrawing of an MLE box. | |
4920 * Parameters: | |
4921 * handle: Handle to the MLE to thaw. | |
4922 */ | |
4923 void dw_mle_thaw(HWND handle) | |
4924 { | |
4925 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); | |
4926 } | |
4927 | |
4928 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4929 * Returns the range of the percent bar. |
3 | 4930 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4931 * handle: Handle to the percent bar to be queried. |
3 | 4932 */ |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4933 unsigned int dw_percent_query_range(HWND handle) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4934 { |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4935 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); |
3 | 4936 } |
4937 | |
4938 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4939 * Sets the percent bar position. |
3 | 4940 * Parameters: |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4941 * handle: Handle to the percent bar to be set. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4942 * position: Position of the percent bar withing the range. |
3 | 4943 */ |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4944 void dw_percent_set_pos(HWND handle, unsigned int position) |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4945 { |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4946 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position); |
3 | 4947 } |
4948 | |
4949 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4950 * Returns the position of the slider. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4951 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4952 * handle: Handle to the slider to be queried. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4953 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4954 unsigned int dw_slider_query_pos(HWND handle) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4955 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4956 return (unsigned int)WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4957 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4958 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4959 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4960 * Sets the slider position. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4961 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4962 * handle: Handle to the slider to be set. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4963 * position: Position of the slider withing the range. |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4964 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4965 void dw_slider_set_pos(HWND handle, unsigned int position) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4966 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4967 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)position); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4968 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4969 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4970 /* |
3 | 4971 * Sets the spinbutton value. |
4972 * Parameters: | |
4973 * handle: Handle to the spinbutton to be set. | |
4974 * position: Current value of the spinbutton. | |
4975 */ | |
4976 void dw_spinbutton_set_pos(HWND handle, long position) | |
4977 { | |
4978 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L); | |
4979 } | |
4980 | |
4981 /* | |
4982 * Sets the spinbutton limits. | |
4983 * Parameters: | |
4984 * handle: Handle to the spinbutton to be set. | |
4985 * upper: Upper limit. | |
4986 * lower: Lower limit. | |
4987 */ | |
4988 void dw_spinbutton_set_limits(HWND handle, long upper, long lower) | |
4989 { | |
4990 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower)); | |
4991 } | |
4992 | |
4993 /* | |
4994 * Sets the entryfield character limit. | |
4995 * Parameters: | |
4996 * handle: Handle to the spinbutton to be set. | |
4997 * limit: Number of characters the entryfield will take. | |
4998 */ | |
4999 void dw_entryfield_set_limit(HWND handle, ULONG limit) | |
5000 { | |
5001 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0); | |
5002 } | |
5003 | |
5004 | |
5005 /* | |
5006 * Returns the current value of the spinbutton. | |
5007 * Parameters: | |
5008 * handle: Handle to the spinbutton to be queried. | |
5009 */ | |
5010 long dw_spinbutton_query(HWND handle) | |
5011 { | |
5012 long tmpval = 0L; | |
5013 | |
5014 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L); | |
5015 return tmpval; | |
5016 } | |
5017 | |
5018 /* | |
5019 * Returns the state of the checkbox. | |
5020 * Parameters: | |
5021 * handle: Handle to the checkbox to be queried. | |
5022 */ | |
5023 int dw_checkbox_query(HWND handle) | |
5024 { | |
5025 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0); | |
5026 } | |
5027 | |
5028 /* | |
5029 * Sets the state of the checkbox. | |
5030 * Parameters: | |
5031 * handle: Handle to the checkbox to be queried. | |
5032 * value: TRUE for checked, FALSE for unchecked. | |
5033 */ | |
5034 void dw_checkbox_set(HWND handle, int value) | |
5035 { | |
5036 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0); | |
5037 } | |
5038 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5039 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5040 * Inserts an item into a tree window (widget) after another item. |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5041 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5042 * handle: Handle to the tree to be inserted. |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5043 * item: Handle to the item to be positioned after. |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5044 * title: The text title of the entry. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5045 * icon: Handle to coresponding icon. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5046 * parent: Parent handle or 0 if root. |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5047 * itemdata: Item specific data. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5048 */ |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5049 HWND dw_tree_insert_after(HWND handle, HWND item, char *title, unsigned long icon, HWND parent, void *itemdata) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5050 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5051 ULONG cbExtra; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5052 PCNRITEM pci; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5053 RECORDINSERT ri; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5054 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5055 if(!item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5056 item = CMA_FIRST; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5057 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5058 /* Calculate extra bytes needed for each record besides that needed for the |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5059 * MINIRECORDCORE structure |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5060 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5061 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5062 cbExtra = sizeof(CNRITEM) - sizeof(MINIRECORDCORE); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5063 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5064 /* Allocate memory for the parent record */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5065 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5066 pci = WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5067 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5068 /* Fill in the parent record data */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5069 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5070 pci->rc.cb = sizeof(MINIRECORDCORE); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5071 pci->rc.pszIcon = strdup(title); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5072 pci->rc.hptrIcon = icon; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5073 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5074 pci->hptrIcon = icon; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5075 pci->user = itemdata; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5076 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5077 memset(&ri, 0, sizeof(RECORDINSERT)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5078 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5079 ri.cb = sizeof(RECORDINSERT); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5080 ri.pRecordOrder = (PRECORDCORE)item; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5081 ri.pRecordParent = (PRECORDCORE)NULL; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5082 ri.zOrder = (USHORT)CMA_TOP; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5083 ri.cRecordsInsert = 1; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5084 ri.fInvalidateRecord = TRUE; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5085 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5086 /* We are about to insert the child records. Set the parent record to be |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5087 * the one we just inserted. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5088 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5089 ri.pRecordParent = (PRECORDCORE)parent; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5090 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5091 /* Insert the record */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5092 WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5093 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5094 return (HWND)pci; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5095 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5096 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5097 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5098 * Inserts an item into a tree window (widget). |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5099 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5100 * handle: Handle to the tree to be inserted. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5101 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5102 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5103 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5104 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5105 */ |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5106 HWND dw_tree_insert(HWND handle, char *title, unsigned long icon, HWND parent, void *itemdata) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5107 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5108 return dw_tree_insert_after(handle, (HWND)CMA_END, title, icon, parent, itemdata); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5109 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5110 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5111 /* |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5112 * Sets the text and icon of an item in a tree window (widget). |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5113 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5114 * handle: Handle to the tree containing the item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5115 * item: Handle of the item to be modified. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5116 * title: The text title of the entry. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5117 * icon: Handle to coresponding icon. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5118 */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5119 void dw_tree_set(HWND handle, HWND item, char *title, unsigned long icon) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5120 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5121 PCNRITEM pci = (PCNRITEM)item; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5122 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5123 if(!pci) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5124 return; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5125 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5126 if(pci->rc.pszIcon) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5127 free(pci->rc.pszIcon); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5128 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5129 pci->rc.pszIcon = strdup(title); |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5130 pci->rc.hptrIcon = icon; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5131 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5132 pci->hptrIcon = icon; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5133 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5134 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_TEXTCHANGED)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5135 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5136 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5137 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5138 * Sets the item data of a tree item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5139 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5140 * handle: Handle to the tree containing the item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5141 * item: Handle of the item to be modified. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5142 * itemdata: User defined data to be associated with item. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5143 */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5144 void dw_tree_set_data(HWND handle, HWND item, void *itemdata) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5145 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5146 PCNRITEM pci = (PCNRITEM)item; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5147 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5148 if(!pci) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5149 return; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5150 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5151 pci->user = itemdata; |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5152 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5153 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5154 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5155 * Sets this item as the active selection. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5156 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5157 * handle: Handle to the tree window (widget) to be selected. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5158 * item: Handle to the item to be selected. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5159 */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5160 void dw_tree_item_select(HWND handle, HWND item) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5161 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5162 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5163 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5164 while(pCore) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5165 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5166 if(pCore->flRecordAttr & CRA_SELECTED) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5167 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5168 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5169 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5170 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)item, MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED)); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5171 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5172 lasthcnr = 0; |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5173 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5174 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5175 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5176 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5177 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5178 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5179 */ |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5180 void dw_tree_clear(HWND handle) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5181 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5182 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, CMA_INVALIDATE | CMA_FREE)); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5183 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5184 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5185 /* |
54
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5186 * Expands a node on a tree. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5187 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5188 * handle: Handle to the tree window (widget). |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5189 * item: Handle to node to be expanded. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5190 */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5191 void dw_tree_expand(HWND handle, HWND item) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5192 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5193 WinSendMsg(handle, CM_EXPANDTREE, MPFROMP(item), 0); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5194 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5195 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5196 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5197 * Collapses a node on a tree. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5198 * Parameters: |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5199 * handle: Handle to the tree window (widget). |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5200 * item: Handle to node to be collapsed. |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5201 */ |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5202 void dw_tree_collapse(HWND handle, HWND item) |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5203 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5204 WinSendMsg(handle, CM_COLLAPSETREE, MPFROMP(item), 0); |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5205 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5206 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5207 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5208 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5209 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5210 * handle: Handle to the window (widget) to be cleared. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5211 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5212 */ |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5213 void dw_tree_delete(HWND handle, HWND item) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5214 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5215 PCNRITEM pci = (PCNRITEM)item; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5216 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5217 if(!item) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5218 return; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5219 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5220 if(pci->rc.pszIcon) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5221 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5222 free(pci->rc.pszIcon); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5223 pci->rc.pszIcon = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5224 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5225 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5226 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_INVALIDATE | CMA_FREE)); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5227 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5228 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5229 /* Some OS/2 specific container structs */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5230 typedef struct _containerinfo { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5231 int count; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5232 void *data; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5233 HWND handle; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5234 } ContainerInfo; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5235 |
3 | 5236 /* |
5237 * Sets up the container columns. | |
5238 * Parameters: | |
5239 * handle: Handle to the container to be configured. | |
5240 * flags: An array of unsigned longs with column flags. | |
5241 * titles: An array of strings with column text titles. | |
5242 * count: The number of columns (this should match the arrays). | |
5243 * separator: The column number that contains the main separator. | |
5244 * (this item may only be used in OS/2) | |
5245 */ | |
5246 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) | |
5247 { | |
5248 PFIELDINFO details, first, left = NULL; | |
5249 FIELDINFOINSERT detin; | |
5250 CNRINFO cnri; | |
5251 int z; | |
5252 ULONG size = sizeof(RECORDCORE); | |
5253 ULONG *offStruct = malloc(count * sizeof(ULONG)); | |
5254 ULONG *tempflags = malloc((count+1) * sizeof(ULONG)); | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
5255 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
5256 ULONG *oldflags = blah ? blah->data : 0; |
3 | 5257 |
5258 if(!offStruct || !tempflags) | |
5259 return FALSE; | |
5260 | |
5261 memcpy(tempflags, flags, count * sizeof(ULONG)); | |
5262 tempflags[count] = 0; | |
5263 | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
5264 blah->data = tempflags; |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5265 blah->flags = separator; |
3 | 5266 |
5267 if(oldflags) | |
5268 free(oldflags); | |
5269 | |
5270 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL) | |
5271 { | |
5272 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE)); | |
5273 } | |
5274 | |
5275 /* Figure out the offsets to the items in the struct */ | |
5276 for(z=0;z<count;z++) | |
5277 { | |
5278 offStruct[z] = size; | |
5279 if(flags[z] & DW_CFA_BITMAPORICON) | |
5280 size += sizeof(HPOINTER); | |
5281 else if(flags[z] & DW_CFA_STRING) | |
5282 size += sizeof(char *); | |
5283 else if(flags[z] & DW_CFA_ULONG) | |
5284 size += sizeof(ULONG); | |
5285 else if(flags[z] & DW_CFA_DATE) | |
5286 size += sizeof(CDATE); | |
5287 else if(flags[z] & DW_CFA_TIME) | |
5288 size += sizeof(CTIME); | |
5289 } | |
5290 | |
5291 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L); | |
5292 | |
5293 if(!first) | |
5294 { | |
5295 free(offStruct); | |
5296 return FALSE; | |
5297 } | |
5298 | |
5299 for(z=0;z<count;z++) | |
5300 { | |
5301 if(z==separator-1) | |
5302 left=details; | |
5303 details->cb = sizeof(FIELDINFO); | |
5304 details->flData = flags[z]; | |
5305 details->flTitle = CFA_FITITLEREADONLY; | |
5306 details->pTitleData = titles[z]; | |
5307 details->offStruct = offStruct[z]; | |
5308 details = details->pNextFieldInfo; | |
5309 } | |
5310 | |
5311 detin.cb = sizeof(FIELDINFOINSERT); | |
5312 detin.fInvalidateFieldInfo = FALSE; | |
5313 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST; | |
5314 detin.cFieldInfoInsert = (ULONG)count; | |
5315 | |
5316 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin)); | |
5317 | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
5318 if(count > separator && separator > 0) |
3 | 5319 { |
5320 cnri.cb = sizeof(CNRINFO); | |
5321 cnri.pFieldInfoLast = left; | |
5322 cnri.xVertSplitbar = 150; | |
5323 | |
5324 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR)); | |
5325 } | |
5326 | |
5327 free(offStruct); | |
5328 return TRUE; | |
5329 } | |
5330 | |
5331 /* | |
5332 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
5333 * Parameters: | |
5334 * handle: Handle to the container to be configured. | |
5335 * flags: An array of unsigned longs with column flags. | |
5336 * titles: An array of strings with column text titles. | |
5337 * count: The number of columns (this should match the arrays). | |
5338 */ | |
5339 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) | |
5340 { | |
5341 char **newtitles = malloc(sizeof(char *) * (count + 2)); | |
5342 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); | |
5343 | |
5344 newtitles[0] = "Icon"; | |
5345 newtitles[1] = "Filename"; | |
5346 | |
5347 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR; | |
5348 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | |
5349 | |
5350 memcpy(&newtitles[2], titles, sizeof(char *) * count); | |
5351 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); | |
5352 | |
5353 dw_container_setup(handle, newflags, newtitles, count + 2, 2); | |
5354 | |
5355 free(newtitles); | |
5356 free(newflags); | |
5357 return TRUE; | |
5358 } | |
5359 | |
5360 /* | |
5361 * Obtains an icon from a module (or header in GTK). | |
5362 * Parameters: | |
5363 * module: Handle to module (DLL) in OS/2 and Windows. | |
5364 * id: A unsigned long id int the resources on OS/2 and | |
5365 * Windows, on GTK this is converted to a pointer | |
5366 * to an embedded XPM. | |
5367 */ | |
5368 unsigned long dw_icon_load(unsigned long module, unsigned long id) | |
5369 { | |
5370 return WinLoadPointer(HWND_DESKTOP,module,id); | |
5371 } | |
5372 | |
5373 /* | |
5374 * Frees a loaded resource in OS/2 and Windows. | |
5375 * Parameters: | |
5376 * handle: Handle to icon returned by dw_icon_load(). | |
5377 */ | |
5378 void dw_icon_free(unsigned long handle) | |
5379 { | |
5380 WinDestroyPointer(handle); | |
5381 } | |
5382 | |
5383 /* | |
5384 * Allocates memory used to populate a container. | |
5385 * Parameters: | |
5386 * handle: Handle to the container window (widget). | |
5387 * rowcount: The number of items to be populated. | |
5388 */ | |
5389 void *dw_container_alloc(HWND handle, int rowcount) | |
5390 { | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
5391 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
5392 ULONG *flags = wd ? wd->data : 0; |
3 | 5393 int z, size = 0, totalsize, count = 0; |
5394 PRECORDCORE temp; | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5395 ContainerInfo *ci; |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5396 void *blah = NULL; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5397 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5398 if(!flags || rowcount < 1) |
3 | 5399 return NULL; |
5400 | |
5401 while(flags[count]) | |
5402 count++; | |
5403 | |
5404 /* Figure out the offsets to the items in the struct */ | |
5405 for(z=0;z<count;z++) | |
5406 { | |
5407 if(flags[z] & DW_CFA_BITMAPORICON) | |
5408 size += sizeof(HPOINTER); | |
5409 else if(flags[z] & DW_CFA_STRING) | |
5410 size += sizeof(char *); | |
5411 else if(flags[z] & DW_CFA_ULONG) | |
5412 size += sizeof(ULONG); | |
5413 else if(flags[z] & DW_CFA_DATE) | |
5414 size += sizeof(CDATE); | |
5415 else if(flags[z] & DW_CFA_TIME) | |
5416 size += sizeof(CTIME); | |
5417 } | |
5418 | |
5419 totalsize = size + sizeof(RECORDCORE); | |
5420 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5421 z = 0; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5422 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5423 while((blah = (void *)WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount))) == NULL) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5424 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5425 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5426 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5427 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5428 dw_main_sleep(1); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5429 } |
3 | 5430 |
5431 if(!blah) | |
5432 return NULL; | |
5433 | |
5434 temp = (PRECORDCORE)blah; | |
5435 | |
5436 for(z=0;z<rowcount;z++) | |
5437 { | |
5438 temp->cb = totalsize; | |
5439 temp = temp->preccNextRecord; | |
5440 } | |
5441 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5442 ci = malloc(sizeof(struct _containerinfo)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5443 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5444 ci->count = rowcount; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5445 ci->data = blah; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5446 ci->handle = handle; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5447 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5448 return (void *)ci; |
3 | 5449 } |
5450 | |
5451 /* | |
5452 * Sets an item in specified row and column to the given data. | |
5453 * Parameters: | |
5454 * handle: Handle to the container window (widget). | |
5455 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5456 * column: Zero based column of data being set. | |
5457 * row: Zero based row of data being set. | |
5458 * data: Pointer to the data to be added. | |
5459 */ | |
5460 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) | |
5461 { | |
67
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
5462 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
5463 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5464 int z, currentcount; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5465 ContainerInfo *ci = (ContainerInfo *)pointer; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5466 PRECORDCORE temp; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5467 CNRINFO cnr; |
3 | 5468 void *dest; |
5469 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5470 if(!ci) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5471 return; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5472 |
3 | 5473 if(!flags) |
5474 return; | |
5475 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5476 temp = (PRECORDCORE)ci->data; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5477 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5478 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5479 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5480 while(WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5481 { |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5482 z++; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5483 if(z > 5000000) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5484 return; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5485 dw_main_sleep(1); |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5486 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5487 currentcount = cnr.cRecords; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5488 |
3 | 5489 /* Figure out the offsets to the items in the struct */ |
5490 for(z=0;z<column;z++) | |
5491 { | |
5492 if(flags[z] & DW_CFA_BITMAPORICON) | |
5493 size += sizeof(HPOINTER); | |
5494 else if(flags[z] & DW_CFA_STRING) | |
5495 size += sizeof(char *); | |
5496 else if(flags[z] & DW_CFA_ULONG) | |
5497 size += sizeof(ULONG); | |
5498 else if(flags[z] & DW_CFA_DATE) | |
5499 size += sizeof(CDATE); | |
5500 else if(flags[z] & DW_CFA_TIME) | |
5501 size += sizeof(CTIME); | |
5502 } | |
5503 | |
5504 totalsize = size + sizeof(RECORDCORE); | |
5505 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5506 for(z=0;z<(row-currentcount);z++) |
3 | 5507 temp = temp->preccNextRecord; |
5508 | |
5509 dest = (void *)(((ULONG)temp)+((ULONG)totalsize)); | |
5510 | |
5511 if(flags[column] & DW_CFA_BITMAPORICON) | |
5512 memcpy(dest, data, sizeof(HPOINTER)); | |
5513 else if(flags[column] & DW_CFA_STRING) | |
5514 memcpy(dest, data, sizeof(char *)); | |
5515 else if(flags[column] & DW_CFA_ULONG) | |
5516 memcpy(dest, data, sizeof(ULONG)); | |
5517 else if(flags[column] & DW_CFA_DATE) | |
5518 memcpy(dest, data, sizeof(CDATE)); | |
5519 else if(flags[column] & DW_CFA_TIME) | |
5520 memcpy(dest, data, sizeof(CTIME)); | |
5521 } | |
5522 | |
5523 /* | |
5524 * Sets an item in specified row and column to the given data. | |
5525 * Parameters: | |
5526 * handle: Handle to the container window (widget). | |
5527 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5528 * column: Zero based column of data being set. | |
5529 * row: Zero based row of data being set. | |
5530 * data: Pointer to the data to be added. | |
5531 */ | |
5532 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) | |
5533 { | |
5534 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); | |
5535 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); | |
5536 } | |
5537 | |
5538 /* | |
5539 * Sets an item in specified row and column to the given data. | |
5540 * Parameters: | |
5541 * handle: Handle to the container window (widget). | |
5542 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5543 * column: Zero based column of data being set. | |
5544 * row: Zero based row of data being set. | |
5545 * data: Pointer to the data to be added. | |
5546 */ | |
5547 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) | |
5548 { | |
5549 dw_container_set_item(handle, pointer, column + 2, row, data); | |
5550 } | |
5551 | |
5552 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5553 * Sets the width of a column in the container. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5554 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5555 * handle: Handle to window (widget) of container. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5556 * column: Zero based column of width being set. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5557 * width: Width of column in pixels. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5558 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5559 void dw_container_set_column_width(HWND handle, int column, int width) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5560 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5561 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5562 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5563 /* |
3 | 5564 * Sets the title of a row in the container. |
5565 * Parameters: | |
5566 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5567 * row: Zero based row of data being set. | |
5568 * title: String title of the item. | |
5569 */ | |
5570 void dw_container_set_row_title(void *pointer, int row, char *title) | |
5571 { | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5572 ContainerInfo *ci = (ContainerInfo *)pointer; |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5573 PRECORDCORE temp; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5574 int z, currentcount; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5575 CNRINFO cnr; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5576 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5577 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5578 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5579 |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5580 temp = (PRECORDCORE)ci->data; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5581 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5582 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5583 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5584 while(WinSendMsg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5585 { |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5586 z++; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5587 if(z > 5000000) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5588 return; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5589 dw_main_sleep(1); |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5590 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5591 currentcount = cnr.cRecords; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5592 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5593 for(z=0;z<(row-currentcount);z++) |
3 | 5594 temp = temp->preccNextRecord; |
5595 | |
5596 temp->pszIcon = title; | |
5597 temp->pszName = title; | |
5598 temp->pszText = title; | |
5599 } | |
5600 | |
5601 /* | |
5602 * Sets the title of a row in the container. | |
5603 * Parameters: | |
5604 * handle: Handle to the container window (widget). | |
5605 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5606 * rowcount: The number of rows to be inserted. | |
5607 */ | |
5608 void dw_container_insert(HWND handle, void *pointer, int rowcount) | |
5609 { | |
5610 RECORDINSERT recin; | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5611 ContainerInfo *ci = (ContainerInfo *)pointer; |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5612 int z; |
3 | 5613 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5614 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5615 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5616 |
3 | 5617 recin.cb = sizeof(RECORDINSERT); |
5618 recin.pRecordOrder = (PRECORDCORE)CMA_END; | |
5619 recin.pRecordParent = NULL; | |
5620 recin.zOrder = CMA_TOP; | |
5621 recin.fInvalidateRecord = TRUE; | |
5622 recin.cRecordsInsert = rowcount; | |
5623 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5624 z = 0; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5625 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5626 while(WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin)) == 0) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5627 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5628 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5629 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5630 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5631 dw_main_sleep(1); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5632 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5633 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5634 free(ci); |
3 | 5635 } |
5636 | |
5637 /* | |
5638 * Removes all rows from a container. | |
5639 * Parameters: | |
5640 * handle: Handle to the window (widget) to be cleared. | |
52
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
5641 * redraw: TRUE to cause the container to redraw immediately. |
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
5642 */ |
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
5643 void dw_container_clear(HWND handle, int redraw) |
3 | 5644 { |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5645 int z = 0; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5646 |
52
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
5647 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE)) == -1) |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5648 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5649 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5650 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5651 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5652 dw_main_sleep(1); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5653 } |
3 | 5654 } |
5655 | |
5656 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5657 * Removes the first x rows from a container. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5658 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5659 * handle: Handle to the window (widget) to be deleted from. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5660 * rowcount: The number of rows to be deleted. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5661 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5662 void dw_container_delete(HWND handle, int rowcount) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5663 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5664 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5665 int current = 1, z; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5666 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5667 prc[0] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5668 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5669 while(last && current < rowcount) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5670 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5671 prc[current] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)last, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5672 current++; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5673 } |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5674 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5675 z = 0; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5676 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5677 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | CMA_FREE)) == -1) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5678 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5679 z++; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5680 if(z > 5000000) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5681 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5682 dw_main_sleep(1); |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5683 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5684 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5685 free(prc); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5686 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5687 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5688 /* |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5689 * Scrolls container up or down. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5690 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5691 * handle: Handle to the window (widget) to be scrolled. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5692 * direction: DW_SCROLL_UP, DW_SCROLL_DOWN, DW_SCROLL_TOP or |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5693 * DW_SCROLL_BOTTOM. (rows is ignored for last two) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5694 * rows: The number of rows to be scrolled. |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5695 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5696 void dw_container_scroll(HWND handle, int direction, long rows) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5697 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5698 switch(direction) |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5699 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5700 case DW_SCROLL_TOP: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5701 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-10000000)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5702 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5703 case DW_SCROLL_BOTTOM: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5704 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(10000000)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5705 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5706 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5707 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5708 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5709 /* |
3 | 5710 * Removes all rows from a container. |
5711 * Parameters: | |
5712 * handle: Handle to the window (widget) to be cleared. | |
5713 */ | |
5714 void dw_container_set_view(HWND handle, unsigned long flags, int iconwidth, int iconheight) | |
5715 { | |
5716 CNRINFO cnrinfo; | |
5717 | |
5718 cnrinfo.flWindowAttr = flags; | |
5719 cnrinfo.slBitmapOrIcon.cx = iconwidth; | |
5720 cnrinfo.slBitmapOrIcon.cy = iconheight; | |
5721 | |
5722 WinSendMsg(handle, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON)); | |
5723 } | |
5724 | |
5725 /* | |
5726 * Starts a new query of a container. | |
5727 * Parameters: | |
5728 * handle: Handle to the window (widget) to be queried. | |
5729 * flags: If this parameter is DW_CRA_SELECTED it will only | |
5730 * return items that are currently selected. Otherwise | |
5731 * it will return all records in the container. | |
5732 */ | |
5733 char *dw_container_query_start(HWND handle, unsigned long flags) | |
5734 { | |
5735 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | |
5736 if(pCore) | |
5737 { | |
5738 if(flags) | |
5739 { | |
5740 while(pCore) | |
5741 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5742 if(pCore->flRecordAttr & flags) |
3 | 5743 return pCore->pszIcon; |
5744 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
5745 } | |
5746 } | |
5747 else | |
5748 return pCore->pszIcon; | |
5749 } | |
5750 return NULL; | |
5751 } | |
5752 | |
5753 /* | |
5754 * Continues an existing query of a container. | |
5755 * Parameters: | |
5756 * handle: Handle to the window (widget) to be queried. | |
5757 * flags: If this parameter is DW_CRA_SELECTED it will only | |
5758 * return items that are currently selected. Otherwise | |
5759 * it will return all records in the container. | |
5760 */ | |
5761 char *dw_container_query_next(HWND handle, unsigned long flags) | |
5762 { | |
5763 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
5764 if(pCore) | |
5765 { | |
5766 if(flags) | |
5767 { | |
5768 while(pCore) | |
5769 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5770 if(pCore->flRecordAttr & flags) |
3 | 5771 return pCore->pszIcon; |
5772 | |
5773 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
5774 } | |
5775 } | |
5776 else | |
5777 return pCore->pszIcon; | |
5778 } | |
5779 return NULL; | |
5780 } | |
5781 | |
5782 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5783 * Cursors the item with the text speficied, and scrolls to that item. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5784 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5785 * handle: Handle to the window (widget) to be queried. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5786 * text: Text usually returned by dw_container_query(). |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5787 */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5788 void dw_container_cursor(HWND handle, char *text) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5789 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5790 RECTL viewport, item; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5791 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5792 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5793 while(pCore) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5794 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5795 if(pCore->pszIcon == text) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5796 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5797 QUERYRECORDRECT qrr; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5798 int scrollpixels = 0, midway; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5799 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5800 qrr.cb = sizeof(QUERYRECORDRECT); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5801 qrr.pRecord = pCore; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5802 qrr.fRightSplitWindow = 0; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5803 qrr.fsExtent = CMA_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5804 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5805 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(TRUE, CRA_CURSORED)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5806 WinSendMsg(handle, CM_QUERYVIEWPORTRECT, (MPARAM)&viewport, MPFROM2SHORT(CMA_WORKSPACE, FALSE)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5807 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5808 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5809 midway = (viewport.yTop - viewport.yBottom)/2; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5810 scrollpixels = viewport.yTop - (item.yTop + midway); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5811 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5812 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5813 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5814 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5815 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5816 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5817 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5818 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5819 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5820 /* |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5821 * Optimizes the column widths so that all data is visible. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5822 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5823 * handle: Handle to the window (widget) to be optimized. |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5824 */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5825 void dw_container_optimize(HWND handle) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5826 { |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5827 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5828 RECTL item; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5829 PRECORDCORE pCore = NULL; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5830 int max = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5831 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5832 if(blah && !blah->flags) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5833 return; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5834 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5835 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5836 while(pCore) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5837 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5838 QUERYRECORDRECT qrr; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5839 int vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5840 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5841 qrr.cb = sizeof(QUERYRECORDRECT); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5842 qrr.pRecord = pCore; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5843 qrr.fRightSplitWindow = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5844 qrr.fsExtent = CMA_TEXT; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5845 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5846 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5847 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5848 vector = item.xRight - item.xLeft; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5849 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5850 if(vector > max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5851 max = vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5852 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5853 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5854 } |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5855 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5856 if(max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5857 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5858 CNRINFO cnri; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5859 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5860 cnri.cb = sizeof(CNRINFO); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5861 cnri.xVertSplitbar = max; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5862 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5863 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_XVERTSPLITBAR)); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5864 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5865 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5866 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5867 /* |
3 | 5868 * Creates a rendering context widget (window) to be packed. |
5869 * Parameters: | |
5870 * id: An id to be used with dw_window_from_id. | |
5871 * Returns: | |
5872 * A handle to the widget or NULL on failure. | |
5873 */ | |
5874 HWND dw_render_new(unsigned long id) | |
5875 { | |
5876 HWND hwndframe = WinCreateWindow(HWND_OBJECT, | |
5877 WC_FRAME, | |
5878 NULL, | |
47
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
5879 WS_VISIBLE | |
997e9ed670ef
Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
40
diff
changeset
|
5880 FS_NOBYTEALIGN, |
3 | 5881 0,0,2000,1000, |
5882 NULLHANDLE, | |
5883 HWND_TOP, | |
5884 id, | |
5885 NULL, | |
5886 NULL); | |
5887 WinSubclassWindow(hwndframe, _RendProc); | |
5888 return hwndframe; | |
5889 } | |
5890 | |
5891 /* Sets the current foreground drawing color. | |
5892 * Parameters: | |
5893 * red: red value. | |
5894 * green: green value. | |
5895 * blue: blue value. | |
5896 */ | |
5897 void dw_color_foreground_set(unsigned long value) | |
5898 { | |
5899 _foreground = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value); | |
5900 } | |
5901 | |
5902 /* Sets the current background drawing color. | |
5903 * Parameters: | |
5904 * red: red value. | |
5905 * green: green value. | |
5906 * blue: blue value. | |
5907 */ | |
5908 void dw_color_background_set(unsigned long value) | |
5909 { | |
5910 _background = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value); | |
5911 } | |
5912 | |
5913 HPS _set_hps(HPS hps) | |
5914 { | |
5915 LONG alTable[18]; | |
5916 | |
5917 GpiQueryLogColorTable(hps, 0L, 0L, 18L, alTable); | |
5918 | |
5919 alTable[16] = _foreground; | |
5920 alTable[17] = _background; | |
5921 | |
5922 GpiCreateLogColorTable(hps, | |
5923 0L, | |
5924 LCOLF_CONSECRGB, | |
5925 0L, | |
5926 18, | |
5927 alTable); | |
5928 GpiSetColor(hps, 16); | |
5929 GpiSetBackColor(hps, 17); | |
5930 return hps; | |
5931 } | |
5932 | |
5933 HPS _set_colors(HWND handle) | |
5934 { | |
5935 HPS hps = WinGetPS(handle); | |
5936 | |
5937 _set_hps(hps); | |
5938 return hps; | |
5939 } | |
5940 | |
5941 /* Draw a point on a window (preferably a render window). | |
5942 * Parameters: | |
5943 * handle: Handle to the window. | |
5944 * pixmap: Handle to the pixmap. (choose only one of these) | |
5945 * x: X coordinate. | |
5946 * y: Y coordinate. | |
5947 */ | |
5948 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) | |
5949 { | |
5950 HPS hps; | |
5951 int height; | |
5952 POINTL ptl; | |
5953 | |
5954 if(handle) | |
5955 { | |
5956 hps = _set_colors(handle); | |
5957 height = _get_height(handle); | |
5958 } | |
5959 else if(pixmap) | |
5960 { | |
5961 hps = _set_hps(pixmap->hps); | |
5962 height = pixmap->height; | |
5963 } | |
5964 else | |
5965 return; | |
5966 | |
5967 ptl.x = x; | |
5968 ptl.y = height - y - 1; | |
5969 | |
5970 GpiSetPel(hps, &ptl); | |
5971 if(!pixmap) | |
5972 WinReleasePS(hps); | |
5973 } | |
5974 | |
5975 /* Draw a line on a window (preferably a render window). | |
5976 * Parameters: | |
5977 * handle: Handle to the window. | |
5978 * pixmap: Handle to the pixmap. (choose only one of these) | |
5979 * x1: First X coordinate. | |
5980 * y1: First Y coordinate. | |
5981 * x2: Second X coordinate. | |
5982 * y2: Second Y coordinate. | |
5983 */ | |
5984 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) | |
5985 { | |
5986 HPS hps; | |
5987 int height; | |
5988 POINTL ptl[2]; | |
5989 | |
5990 if(handle) | |
5991 { | |
5992 hps = _set_colors(handle); | |
5993 height = _get_height(handle); | |
5994 } | |
5995 else if(pixmap) | |
5996 { | |
5997 hps = _set_hps(pixmap->hps); | |
5998 height = pixmap->height; | |
5999 } | |
6000 else | |
6001 return; | |
6002 | |
6003 ptl[0].x = x1; | |
6004 ptl[0].y = height - y1 - 1; | |
6005 ptl[1].x = x2; | |
6006 ptl[1].y = height - y2 - 1; | |
6007 | |
6008 GpiMove(hps, &ptl[0]); | |
6009 GpiLine(hps, &ptl[1]); | |
6010 | |
6011 if(!pixmap) | |
6012 WinReleasePS(hps); | |
6013 } | |
6014 | |
6015 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6016 void _CopyFontSettings(HPS hpsSrc, HPS hpsDst) |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6017 { |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6018 FONTMETRICS fm; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6019 FATTRS fat; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6020 SIZEF sizf; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6021 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6022 GpiQueryFontMetrics(hpsSrc, sizeof(FONTMETRICS), &fm); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6023 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6024 memset(&fat, 0, sizeof(fat)); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6025 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6026 fat.usRecordLength = sizeof(FATTRS); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6027 fat.lMatch = fm.lMatch; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6028 strcpy(fat.szFacename, fm.szFacename); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6029 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6030 GpiCreateLogFont(hpsDst, 0, 1L, &fat); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6031 GpiSetCharSet(hpsDst, 1L); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6032 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6033 sizf.cx = MAKEFIXED(fm.lEmInc,0); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6034 sizf.cy = MAKEFIXED(fm.lMaxBaselineExt,0); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6035 GpiSetCharBox(hpsDst, &sizf ); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6036 } |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6037 |
3 | 6038 /* Draw text on a window (preferably a render window). |
6039 * Parameters: | |
6040 * handle: Handle to the window. | |
6041 * pixmap: Handle to the pixmap. (choose only one of these) | |
6042 * x: X coordinate. | |
6043 * y: Y coordinate. | |
6044 * text: Text to be displayed. | |
6045 */ | |
6046 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) | |
6047 { | |
6048 HPS hps; | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6049 int size = 9, z, height; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6050 RECTL rcl; |
3 | 6051 char fontname[128]; |
6052 | |
6053 if(handle) | |
6054 { | |
6055 hps = _set_colors(handle); | |
6056 height = _get_height(handle); | |
6057 _GetPPFont(handle, fontname); | |
6058 } | |
6059 else if(pixmap) | |
6060 { | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6061 HPS pixmaphps = WinGetPS(pixmap->handle); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6062 |
3 | 6063 hps = _set_hps(pixmap->hps); |
6064 height = pixmap->height; | |
6065 _GetPPFont(pixmap->handle, fontname); | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6066 _CopyFontSettings(pixmaphps, hps); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6067 WinReleasePS(pixmaphps); |
3 | 6068 } |
6069 else | |
6070 return; | |
6071 | |
6072 for(z=0;z<strlen(fontname);z++) | |
6073 { | |
6074 if(fontname[z]=='.') | |
6075 break; | |
6076 } | |
6077 size = atoi(fontname); | |
6078 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6079 rcl.xLeft = x; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6080 rcl.yTop = height - y; |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6081 rcl.yBottom = rcl.yTop - (size*2); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6082 rcl.xRight = rcl.xLeft + (size * strlen(text)); |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6083 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6084 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
3 | 6085 |
6086 if(!pixmap) | |
6087 WinReleasePS(hps); | |
6088 } | |
6089 | |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6090 /* Query the width and height of a text string. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6091 * Parameters: |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6092 * handle: Handle to the window. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6093 * pixmap: Handle to the pixmap. (choose only one of these) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6094 * text: Text to be queried. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6095 * width: Pointer to a variable to be filled in with the width. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6096 * height Pointer to a variable to be filled in with the height. |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6097 */ |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6098 void dw_font_text_extents(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6099 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6100 HPS hps; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6101 POINTL aptl[TXTBOX_COUNT]; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6102 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6103 if(handle) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6104 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6105 hps = _set_colors(handle); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6106 } |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6107 else if(pixmap) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6108 { |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6109 HPS pixmaphps = WinGetPS(pixmap->handle); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6110 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6111 hps = _set_hps(pixmap->hps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6112 _CopyFontSettings(pixmaphps, hps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6113 WinReleasePS(pixmaphps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6114 } |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6115 else |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6116 return; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6117 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6118 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6119 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6120 if(width) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6121 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6122 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6123 if(height) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6124 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y; |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6125 |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6126 if(!pixmap) |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6127 WinReleasePS(hps); |
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
47
diff
changeset
|
6128 } |
3 | 6129 |
6130 /* Draw a rectangle on a window (preferably a render window). | |
6131 * Parameters: | |
6132 * handle: Handle to the window. | |
6133 * pixmap: Handle to the pixmap. (choose only one of these) | |
6134 * fill: Fill box TRUE or FALSE. | |
6135 * x: X coordinate. | |
6136 * y: Y coordinate. | |
6137 * width: Width of rectangle. | |
6138 * height: Height of rectangle. | |
6139 */ | |
6140 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) | |
6141 { | |
6142 HPS hps; | |
6143 int thisheight; | |
6144 POINTL ptl[2]; | |
6145 | |
6146 if(handle) | |
6147 { | |
6148 hps = _set_colors(handle); | |
6149 thisheight = _get_height(handle); | |
6150 } | |
6151 else if(pixmap) | |
6152 { | |
6153 hps = _set_hps(pixmap->hps); | |
6154 thisheight = pixmap->height; | |
6155 } | |
6156 else | |
6157 return; | |
6158 | |
6159 ptl[0].x = x; | |
6160 ptl[0].y = thisheight - y - 1; | |
6161 ptl[1].x = x + width - 1; | |
6162 ptl[1].y = thisheight - y - height; | |
6163 | |
6164 GpiMove(hps, &ptl[0]); | |
6165 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); | |
6166 | |
6167 if(!pixmap) | |
6168 WinReleasePS(hps); | |
6169 } | |
6170 | |
6171 /* Call this after drawing to the screen to make sure | |
6172 * anything you have drawn is visible. | |
6173 */ | |
6174 void dw_flush(void) | |
6175 { | |
6176 } | |
6177 | |
6178 /* | |
6179 * Creates a pixmap with given parameters. | |
6180 * Parameters: | |
6181 * handle: Window handle the pixmap is associated with. | |
6182 * width: Width of the pixmap in pixels. | |
6183 * height: Height of the pixmap in pixels. | |
6184 * depth: Color depth of the pixmap. | |
6185 * Returns: | |
6186 * A handle to a pixmap or NULL on failure. | |
6187 */ | |
6188 HPIXMAP dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) | |
6189 { | |
6190 BITMAPINFOHEADER bmih; | |
6191 SIZEL sizl = { 0, 0 }; | |
6192 HPIXMAP pixmap; | |
6193 HDC hdc; | |
6194 HPS hps; | |
6195 ULONG ulFlags; | |
6196 LONG cPlanes, cBitCount; | |
6197 | |
6198 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
6199 return NULL; | |
6200 | |
6201 hps = WinGetPS(handle); | |
6202 | |
6203 hdc = GpiQueryDevice(hps); | |
6204 ulFlags = GpiQueryPS(hps, &sizl); | |
6205 | |
6206 pixmap->handle = handle; | |
6207 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
6208 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
6209 | |
6210 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes); | |
6211 if (!depth) | |
6212 { | |
6213 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount); | |
6214 depth = cBitCount; | |
6215 } | |
6216 | |
6217 memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); | |
6218 bmih.cbFix = sizeof(BITMAPINFOHEADER); | |
6219 bmih.cx = (SHORT)width; | |
6220 bmih.cy = (SHORT)height; | |
6221 bmih.cPlanes = (SHORT)cPlanes; | |
6222 bmih.cBitCount = (SHORT)depth; | |
6223 | |
6224 pixmap->width = width; pixmap->height = height; | |
6225 | |
6226 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL); | |
6227 | |
6228 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
6229 | |
6230 if (depth>8) | |
6231 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL ); | |
6232 | |
6233 WinReleasePS(hps); | |
6234 | |
6235 return pixmap; | |
6236 } | |
6237 | |
6238 /* | |
6239 * Creates a pixmap from internal resource graphic specified by id. | |
6240 * Parameters: | |
6241 * handle: Window handle the pixmap is associated with. | |
6242 * id: Resource ID associated with requested pixmap. | |
6243 * Returns: | |
6244 * A handle to a pixmap or NULL on failure. | |
6245 */ | |
6246 HPIXMAP dw_pixmap_grab(HWND handle, ULONG id) | |
6247 { | |
6248 BITMAPINFOHEADER bmih; | |
6249 SIZEL sizl = { 0, 0 }; | |
6250 HPIXMAP pixmap; | |
6251 HDC hdc; | |
6252 HPS hps; | |
6253 ULONG ulFlags; | |
6254 | |
6255 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
6256 return NULL; | |
6257 | |
6258 hps = WinGetPS(handle); | |
6259 | |
6260 hdc = GpiQueryDevice(hps); | |
6261 ulFlags = GpiQueryPS(hps, &sizl); | |
6262 | |
6263 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
6264 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
6265 | |
6266 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0); | |
6267 | |
6268 GpiQueryBitmapParameters(pixmap->hbm, &bmih); | |
6269 | |
6270 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
6271 | |
6272 pixmap->width = bmih.cx; pixmap->height = bmih.cy; | |
6273 | |
6274 WinReleasePS(hps); | |
6275 | |
6276 return pixmap; | |
6277 } | |
6278 | |
6279 /* | |
6280 * Destroys an allocated pixmap. | |
6281 * Parameters: | |
6282 * pixmap: Handle to a pixmap returned by | |
6283 * dw_pixmap_new.. | |
6284 */ | |
6285 void dw_pixmap_destroy(HPIXMAP pixmap) | |
6286 { | |
6287 GpiSetBitmap(pixmap->hps, NULLHANDLE); | |
6288 GpiDeleteBitmap(pixmap->hbm); | |
6289 GpiAssociate(pixmap->hps, NULLHANDLE); | |
6290 GpiDestroyPS(pixmap->hps); | |
6291 DevCloseDC(pixmap->hdc); | |
6292 free(pixmap); | |
6293 } | |
6294 | |
6295 /* | |
6296 * Copies from one item to another. | |
6297 * Parameters: | |
6298 * dest: Destination window handle. | |
6299 * destp: Destination pixmap. (choose only one). | |
6300 * xdest: X coordinate of destination. | |
6301 * ydest: Y coordinate of destination. | |
6302 * width: Width of area to copy. | |
6303 * height: Height of area to copy. | |
6304 * src: Source window handle. | |
6305 * srcp: Source pixmap. (choose only one). | |
6306 * xsrc: X coordinate of source. | |
6307 * ysrc: Y coordinate of source. | |
6308 */ | |
6309 void dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) | |
6310 { | |
6311 HPS hpsdest; | |
6312 HPS hpssrc; | |
6313 POINTL ptl[4]; | |
6314 int destheight, srcheight; | |
6315 | |
6316 if(dest) | |
6317 { | |
6318 hpsdest = WinGetPS(dest); | |
6319 destheight = _get_height(dest); | |
6320 } | |
6321 else if(destp) | |
6322 { | |
6323 hpsdest = destp->hps; | |
6324 destheight = destp->height; | |
6325 } | |
6326 else | |
6327 return; | |
6328 | |
6329 if(src) | |
6330 { | |
6331 hpssrc = WinGetPS(src); | |
6332 srcheight = _get_height(src); | |
6333 } | |
6334 else if(srcp) | |
6335 { | |
6336 hpssrc = srcp->hps; | |
6337 srcheight = srcp->height; | |
6338 } | |
6339 else | |
6340 { | |
6341 if(!destp) | |
6342 WinReleasePS(hpsdest); | |
6343 return; | |
6344 } | |
6345 | |
6346 ptl[0].x = xdest; | |
6347 ptl[0].y = (destheight - ydest) - height; | |
6348 ptl[1].x = ptl[0].x + width; | |
6349 ptl[1].y = destheight - ydest; | |
6350 ptl[2].x = xsrc; | |
6351 ptl[2].y = srcheight - (ysrc + height); | |
6352 ptl[3].x = ptl[2].x + width; | |
6353 ptl[3].y = ptl[2].y + height; | |
6354 | |
6355 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE); | |
6356 | |
6357 if(!destp) | |
6358 WinReleasePS(hpsdest); | |
6359 if(!srcp) | |
6360 WinReleasePS(hpssrc); | |
6361 } | |
6362 | |
6363 /* | |
6364 * Emits a beep. | |
6365 * Parameters: | |
6366 * freq: Frequency. | |
6367 * dur: Duration. | |
6368 */ | |
6369 void dw_beep(int freq, int dur) | |
6370 { | |
6371 DosBeep(freq, dur); | |
6372 } | |
6373 | |
6374 /* | |
6375 * Returns the handle to an unnamed mutex semaphore. | |
6376 */ | |
6377 HMTX dw_mutex_new(void) | |
6378 { | |
6379 HMTX mutex; | |
6380 | |
6381 DosCreateMutexSem(NULL, &mutex, 0, FALSE); | |
6382 return mutex; | |
6383 } | |
6384 | |
6385 /* | |
6386 * Closes a semaphore created by dw_mutex_new(). | |
6387 * Parameters: | |
6388 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
6389 */ | |
6390 void dw_mutex_close(HMTX mutex) | |
6391 { | |
6392 DosCloseMutexSem(mutex); | |
6393 } | |
6394 | |
6395 /* | |
6396 * Tries to gain access to the semaphore, if it can't it blocks. | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6397 * If we are in a callback we must keep the message loop running |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6398 * while blocking. |
3 | 6399 * Parameters: |
6400 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
6401 */ | |
6402 void dw_mutex_lock(HMTX mutex) | |
6403 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6404 if(_dwtid == dw_thread_id()) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6405 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6406 int rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6407 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6408 while(rc == ERROR_TIMEOUT) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6409 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6410 dw_main_sleep(10); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6411 rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6412 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6413 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6414 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6415 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT); |
3 | 6416 } |
6417 | |
6418 /* | |
6419 * Reliquishes the access to the semaphore. | |
6420 * Parameters: | |
6421 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
6422 */ | |
6423 void dw_mutex_unlock(HMTX mutex) | |
6424 { | |
6425 DosReleaseMutexSem(mutex); | |
6426 } | |
6427 | |
6428 /* | |
6429 * Returns the handle to an unnamed event semaphore. | |
6430 */ | |
6431 HEV dw_event_new(void) | |
6432 { | |
6433 HEV blah; | |
6434 | |
6435 if(DosCreateEventSem (NULL, &blah, 0L, FALSE)) | |
6436 return 0; | |
6437 | |
6438 return blah; | |
6439 } | |
6440 | |
6441 /* | |
6442 * Resets a semaphore created by dw_event_new(). | |
6443 * Parameters: | |
6444 * eve: The handle to the event returned by dw_event_new(). | |
6445 */ | |
6446 int dw_event_reset(HEV eve) | |
6447 { | |
6448 ULONG count; | |
6449 | |
6450 if(DosResetEventSem(eve, &count)) | |
6451 return FALSE; | |
6452 return TRUE; | |
6453 } | |
6454 | |
6455 /* | |
6456 * Posts a semaphore created by dw_event_new(). Causing all threads | |
6457 * waiting on this event in dw_event_wait to continue. | |
6458 * Parameters: | |
6459 * eve: The handle to the event returned by dw_event_new(). | |
6460 */ | |
6461 int dw_event_post(HEV eve) | |
6462 { | |
6463 if(DosPostEventSem(eve)) | |
6464 return FALSE; | |
6465 return TRUE; | |
6466 } | |
6467 | |
6468 | |
6469 /* | |
6470 * Waits on a semaphore created by dw_event_new(), until the | |
6471 * event gets posted or until the timeout expires. | |
6472 * Parameters: | |
6473 * eve: The handle to the event returned by dw_event_new(). | |
6474 */ | |
6475 int dw_event_wait(HEV eve, unsigned long timeout) | |
6476 { | |
6477 int rc = DosWaitEventSem(eve, timeout); | |
6478 if(!rc) | |
6479 return 1; | |
6480 if(rc == ERROR_TIMEOUT) | |
6481 return -1; | |
6482 return 0; | |
6483 } | |
6484 | |
6485 /* | |
6486 * Closes a semaphore created by dw_event_new(). | |
6487 * Parameters: | |
6488 * eve: The handle to the event returned by dw_event_new(). | |
6489 */ | |
6490 int dw_event_close(HEV *eve) | |
6491 { | |
6492 if(!eve || ~DosCloseEventSem(*eve)) | |
6493 return FALSE; | |
6494 return TRUE; | |
6495 } | |
6496 | |
6497 /* | |
6498 * Encapsulate the message queues on OS/2. | |
6499 */ | |
6500 void _dwthreadstart(void *data) | |
6501 { | |
6502 HAB thishab = WinInitialize(0); | |
6503 HMQ thishmq = WinCreateMsgQueue(dwhab, 0); | |
6504 void (*threadfunc)(void *) = NULL; | |
6505 void **tmp = (void **)data; | |
6506 | |
6507 threadfunc = (void (*)(void *))tmp[0]; | |
6508 threadfunc(tmp[1]); | |
6509 | |
6510 free(tmp); | |
6511 | |
6512 WinDestroyMsgQueue(thishmq); | |
6513 WinTerminate(thishab); | |
6514 } | |
6515 | |
6516 /* | |
6517 * Creates a new thread with a starting point of func. | |
6518 * Parameters: | |
6519 * func: Function which will be run in the new thread. | |
6520 * data: Parameter(s) passed to the function. | |
6521 * stack: Stack size of new thread (OS/2 and Windows only). | |
6522 */ | |
6523 DWTID dw_thread_new(void *func, void *data, int stack) | |
6524 { | |
6525 void **tmp = malloc(sizeof(void *) * 2); | |
6526 | |
6527 tmp[0] = func; | |
6528 tmp[1] = data; | |
6529 | |
6530 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp); | |
6531 } | |
6532 | |
6533 /* | |
6534 * Ends execution of current thread immediately. | |
6535 */ | |
6536 void dw_thread_end(void) | |
6537 { | |
6538 _endthread(); | |
6539 } | |
6540 | |
6541 /* | |
6542 * Returns the current thread's ID. | |
6543 */ | |
6544 DWTID dw_thread_id(void) | |
6545 { | |
6546 return (DWTID)_threadid; | |
6547 } | |
6548 | |
6549 /* | |
6550 * Cleanly terminates a DW session, should be signal handler safe. | |
6551 * Parameters: | |
6552 * exitcode: Exit code reported to the operating system. | |
6553 */ | |
6554 void dw_exit(int exitcode) | |
6555 { | |
6556 /* In case we are in a signal handler, don't | |
6557 * try to free memory that could possibly be | |
6558 * free()'d by the runtime already. | |
6559 */ | |
6560 #ifndef NO_SIGNALS | |
6561 Root = NULL; | |
6562 #endif | |
6563 exit(exitcode); | |
6564 } | |
6565 | |
6566 /* | |
6567 * Pack a splitbar (sizer) into the specified box from the start. | |
6568 * Parameters: | |
6569 * box: Window handle of the box to be packed into. | |
6570 */ | |
6571 void dw_box_pack_splitbar_start(HWND box) | |
6572 { | |
6573 Box *thisbox; | |
6574 | |
6575 if(WinWindowFromID(box, FID_CLIENT)) | |
6576 { | |
6577 box = WinWindowFromID(box, FID_CLIENT); | |
6578 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6579 } | |
6580 else | |
6581 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6582 if(thisbox) | |
6583 { | |
6584 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
6585 SplitbarClassName, | |
6586 NULL, | |
6587 WS_VISIBLE, | |
6588 0,0,2000,1000, | |
6589 NULLHANDLE, | |
6590 HWND_TOP, | |
6591 0L, | |
6592 NULL, | |
6593 NULL); | |
6594 if(thisbox->type == BOXVERT) | |
6595 dw_box_pack_start(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0); | |
6596 else | |
6597 dw_box_pack_start(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0); | |
6598 | |
6599 } | |
6600 } | |
6601 | |
6602 /* | |
6603 * Pack a splitbar (sizer) into the specified box from the end. | |
6604 * Parameters: | |
6605 * box: Window handle of the box to be packed into. | |
6606 */ | |
6607 void dw_box_pack_splitbar_end(HWND box) | |
6608 { | |
6609 Box *thisbox; | |
6610 | |
6611 if(WinWindowFromID(box, FID_CLIENT)) | |
6612 { | |
6613 box = WinWindowFromID(box, FID_CLIENT); | |
6614 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6615 } | |
6616 else | |
6617 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6618 if(thisbox) | |
6619 { | |
6620 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
6621 SplitbarClassName, | |
6622 NULL, | |
6623 WS_VISIBLE, | |
6624 0,0,2000,1000, | |
6625 NULLHANDLE, | |
6626 HWND_TOP, | |
6627 0L, | |
6628 NULL, | |
6629 NULL); | |
6630 if(thisbox->type == BOXVERT) | |
6631 dw_box_pack_end(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0); | |
6632 else | |
6633 dw_box_pack_end(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0); | |
6634 | |
6635 } | |
6636 } | |
6637 | |
6638 /* | |
6639 * Pack windows (widgets) into a box from the start (or top). | |
6640 * Parameters: | |
6641 * box: Window handle of the box to be packed into. | |
6642 * item: Window handle of the item to be back. | |
6643 * width: Width in pixels of the item or -1 to be self determined. | |
6644 * height: Height in pixels of the item or -1 to be self determined. | |
6645 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
6646 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
6647 * pad: Number of pixels of padding around the item. | |
6648 */ | |
6649 void dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
6650 { | |
6651 Box *thisbox; | |
6652 | |
6653 if(WinWindowFromID(box, FID_CLIENT)) | |
6654 { | |
6655 box = WinWindowFromID(box, FID_CLIENT); | |
6656 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6657 } | |
6658 else | |
6659 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6660 if(thisbox) | |
6661 { | |
6662 if(thisbox->type == BOXHORZ) | |
6663 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); | |
6664 else | |
6665 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); | |
6666 } | |
6667 } | |
6668 | |
6669 void dw_box_pack_start_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
6670 { | |
6671 Box *thisbox; | |
6672 | |
6673 if(WinWindowFromID(box, FID_CLIENT)) | |
6674 { | |
6675 box = WinWindowFromID(box, FID_CLIENT); | |
6676 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6677 hsize = TRUE; | |
6678 vsize = TRUE; | |
6679 } | |
6680 else | |
6681 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6682 if(thisbox) | |
6683 { | |
6684 int z; | |
6685 Item *tmpitem, *thisitem = thisbox->items; | |
6686 char tmpbuf[100]; | |
6687 | |
6688 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
6689 | |
6690 for(z=0;z<thisbox->count;z++) | |
6691 { | |
6692 tmpitem[z+1] = thisitem[z]; | |
6693 } | |
6694 | |
6695 WinQueryClassName(item, 99, tmpbuf); | |
6696 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6697 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 6698 tmpitem[0].type = TYPEBOX; |
6699 else | |
6700 tmpitem[0].type = TYPEITEM; | |
6701 | |
6702 tmpitem[0].hwnd = item; | |
6703 tmpitem[0].origwidth = tmpitem[0].width = width; | |
6704 tmpitem[0].origheight = tmpitem[0].height = height; | |
6705 tmpitem[0].pad = pad; | |
6706 if(hsize) | |
6707 tmpitem[0].hsize = SIZEEXPAND; | |
6708 else | |
6709 tmpitem[0].hsize = SIZESTATIC; | |
6710 | |
6711 if(vsize) | |
6712 tmpitem[0].vsize = SIZEEXPAND; | |
6713 else | |
6714 tmpitem[0].vsize = SIZESTATIC; | |
6715 | |
6716 thisbox->items = tmpitem; | |
6717 | |
6718 if(thisbox->count) | |
6719 free(thisitem); | |
6720 | |
6721 thisbox->count++; | |
6722 | |
6723 WinQueryClassName(item, 99, tmpbuf); | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
6724 /* Don't set the ownership if it's an entryfield or spinbutton */ |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6725 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0) |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6726 WinSetOwner(item, box); |
3 | 6727 WinSetParent(item, box, FALSE); |
6728 } | |
6729 } | |
6730 | |
6731 /* The following two functions graciously contributed by Peter Nielsen. */ | |
6732 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) { | |
6733 char* pchStart = pchBuffer; | |
6734 char* pchEnd = pchStart + ulSize - 2; | |
6735 | |
6736 while (pchEnd >= pchStart) | |
6737 { | |
6738 if ((pchEnd[0] == '#') && (pchEnd[1] == '@')) | |
6739 { | |
6740 *pchEnd-- = '\0'; | |
6741 while (pchEnd >= pchStart) | |
6742 { | |
6743 if ((pchEnd[0] == '@') && (pchEnd[1] == '#')) | |
6744 { | |
6745 ULONG ulMajor = 0; | |
6746 ULONG ulMinor = 0; | |
6747 | |
6748 char* pch = pchEnd + 2; | |
6749 while (!isdigit (*pch) && *pch) | |
6750 pch++; | |
6751 | |
6752 while (isdigit (*pch)) | |
6753 ulMajor = ulMajor * 10 + *pch++ - '0'; | |
6754 | |
6755 if (*pch == '.') | |
6756 { | |
6757 while (isdigit (*++pch)) | |
6758 ulMinor = ulMinor * 10 + *pch - '0'; | |
6759 } | |
6760 return ((ulMajor << 16) | ulMinor); | |
6761 } | |
6762 pchEnd--; | |
6763 } | |
6764 } | |
6765 pchEnd--; | |
6766 } | |
6767 return (0); | |
6768 } | |
6769 | |
6770 ULONG _GetSystemBuildLevel(void) { | |
6771 /* The build level info is normally available in the end of the OS2KRNL file. However, this is not the case in some beta versions of OS/2. | |
6772 * We first try to find the info in the 256 last bytes of the file. If that fails, we load the entire file and search it completely. | |
6773 */ | |
6774 ULONG ulBootDrive = 0; | |
6775 ULONG ulBuild = 0; | |
6776 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR) | |
6777 { | |
6778 char achFileName[11] = { (char)('A'+ulBootDrive-1),':','\\','O','S','2','K','R','N','L','\0' }; | |
6779 HFILE hfile; | |
6780 ULONG ulResult; | |
6781 if (DosOpen (achFileName, &hfile, &ulResult, 0, 0, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL) == NO_ERROR) | |
6782 { | |
6783 ULONG ulFileSize = 0; | |
6784 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR) | |
6785 { | |
6786 const ULONG ulFirstTry = min (256, ulFileSize); | |
6787 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR) | |
6788 { | |
6789 char *pchBuffer = malloc(ulFirstTry); | |
6790 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR) | |
6791 { | |
6792 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry); | |
6793 if (ulBuild == 0) | |
6794 { | |
6795 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR) | |
6796 { | |
6797 free(pchBuffer); | |
6798 pchBuffer = malloc(ulFileSize); | |
6799 | |
6800 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR) | |
6801 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize); | |
6802 } | |
6803 } | |
6804 } | |
6805 free(pchBuffer); | |
6806 } | |
6807 } | |
6808 DosClose (hfile); | |
6809 } | |
6810 } | |
6811 return (ulBuild); | |
6812 } | |
6813 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6814 /* |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6815 * Sets the default focus item for a window/dialog. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6816 * Parameters: |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6817 * window: Toplevel window or dialog. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6818 * defaultitem: Handle to the dialog item to be default. |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6819 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6820 void dw_window_default(HWND window, HWND defaultitem) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6821 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6822 Box *thisbox = NULL; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6823 HWND box; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6824 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6825 box = WinWindowFromID(window, FID_CLIENT); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6826 if(box) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6827 thisbox = WinQueryWindowPtr(box, QWP_USER); |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6828 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6829 if(thisbox) |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6830 thisbox->defaultitem = defaultitem; |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6831 } |
3 | 6832 |
6833 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6834 * Sets window to click the default dialog item when an ENTER is pressed. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6835 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6836 * window: Window (widget) to look for the ENTER press. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6837 * next: Window (widget) to move to next (or click) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6838 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6839 void dw_window_click_default(HWND window, HWND next) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6840 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6841 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6842 char tmpbuf[100]; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6843 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6844 WinQueryClassName(window, 99, tmpbuf); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6845 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6846 /* These are the window classes which can |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6847 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6848 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6849 if(strncmp(tmpbuf, "#6", 3) == 0 && blah) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6850 blah->clickdefault = next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6851 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6852 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6853 /* |
3 | 6854 * Returns some information about the current operating environment. |
6855 * Parameters: | |
6856 * env: Pointer to a DWEnv struct. | |
6857 */ | |
6858 void dw_environment_query(DWEnv *env) | |
6859 { | |
6860 ULONG Build; | |
6861 | |
6862 if(!env) | |
6863 return; | |
6864 | |
6865 /* The default is OS/2 2.0 */ | |
6866 strcpy(env->osName,"OS/2"); | |
6867 env->MajorVersion = 2; | |
6868 env->MinorVersion = 0; | |
6869 | |
6870 Build = _GetSystemBuildLevel(); | |
6871 env->MinorBuild = Build & 0xFFFF; | |
6872 env->MajorBuild = Build >> 16; | |
6873 | |
6874 if (aulBuffer[0] == 20) | |
6875 { | |
6876 int i = (unsigned int)aulBuffer[1]; | |
6877 if (i > 20) | |
6878 { | |
6879 strcpy(env->osName,"Warp"); | |
6880 env->MajorVersion = (int)i/10; | |
6881 env->MinorVersion = i-(((int)i/10)*10); | |
6882 } | |
6883 else if (i == 10) | |
6884 env->MinorVersion = 1; | |
6885 } | |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
6886 strcpy(env->buildDate, __DATE__); |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
6887 strcpy(env->buildTime, __TIME__); |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
6888 env->DWMajorVersion = DW_MAJOR_VERSION; |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
6889 env->DWMinorVersion = DW_MINOR_VERSION; |
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
6890 env->DWSubVersion = DW_SUB_VERSION; |
3 | 6891 } |
6892 | |
6893 /* | |
6894 * Opens a file dialog and queries user selection. | |
6895 * Parameters: | |
6896 * title: Title bar text for dialog. | |
6897 * defpath: The default path of the open dialog. | |
6898 * ext: Default file extention. | |
6899 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
6900 * Returns: | |
6901 * NULL on error. A malloced buffer containing | |
6902 * the file path on success. | |
6903 * | |
6904 */ | |
6905 char *dw_file_browse(char *title, char *defpath, char *ext, int flags) | |
6906 { | |
6907 FILEDLG fild; | |
6908 HWND hwndFile; | |
6909 int len; | |
6910 | |
6911 if(defpath) | |
6912 strcpy(fild.szFullFile, defpath); | |
6913 else | |
6914 strcpy(fild.szFullFile, ""); | |
6915 | |
6916 len = strlen(fild.szFullFile); | |
6917 | |
6918 if(len) | |
6919 { | |
6920 if(fild.szFullFile[len-1] != '\\') | |
6921 strcat(fild.szFullFile, "\\"); | |
6922 } | |
6923 strcat(fild.szFullFile, "*"); | |
6924 | |
6925 if(ext) | |
6926 { | |
6927 strcat(fild.szFullFile, "."); | |
6928 strcat(fild.szFullFile, ext); | |
6929 } | |
6930 | |
6931 fild.cbSize = sizeof(FILEDLG); | |
6932 fild.fl = /*FDS_HELPBUTTON |*/ FDS_CENTER | FDS_OPEN_DIALOG; | |
6933 fild.pszTitle = title; | |
6934 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open"); | |
6935 fild.ulUser = 0L; | |
6936 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc; | |
6937 fild.lReturn = 0L; | |
6938 fild.lSRC = 0L; | |
6939 fild.hMod = 0; | |
6940 fild.x = 0; | |
6941 fild.y = 0; | |
6942 fild.pszIType = (PSZ)NULL; | |
6943 fild.papszITypeList = (PAPSZ)NULL; | |
6944 fild.pszIDrive = (PSZ)NULL; | |
6945 fild.papszIDriveList= (PAPSZ)NULL; | |
6946 fild.sEAType = (SHORT)0; | |
6947 fild.papszFQFilename= (PAPSZ)NULL; | |
6948 fild.ulFQFCount = 0L; | |
6949 | |
6950 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild); | |
6951 if(hwndFile) | |
6952 { | |
6953 switch(fild.lReturn) | |
6954 { | |
6955 case DID_OK: | |
6956 return strdup(fild.szFullFile); | |
6957 case DID_CANCEL: | |
6958 return NULL; | |
6959 } | |
6960 } | |
6961 return NULL; | |
6962 } | |
6963 | |
6964 /* | |
6965 * Execute and external program in a seperate session. | |
6966 * Parameters: | |
6967 * program: Program name with optional path. | |
6968 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
6969 * params: An array of pointers to string arguements. | |
6970 * Returns: | |
6971 * -1 on error. | |
6972 */ | |
6973 int dw_exec(char *program, int type, char **params) | |
6974 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6975 return spawnvp(P_NOWAIT, program, (const char **)params); |
3 | 6976 } |
6977 | |
6978 /* | |
6979 * Loads a web browser pointed at the given URL. | |
6980 * Parameters: | |
6981 * url: Uniform resource locator. | |
6982 */ | |
6983 int dw_browse(char *url) | |
6984 { | |
6985 /* Is there a way to find the webbrowser in Unix? */ | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
6986 char *execargs[3], browser[1024], *newurl = NULL; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
6987 int len; |
3 | 6988 |
6989 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", | |
6990 "DefaultBrowserExe", NULL, browser, 1024); | |
6991 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
6992 len = strlen(browser) - strlen("explore.exe"); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
6993 |
3 | 6994 execargs[0] = browser; |
6995 execargs[1] = url; | |
6996 execargs[2] = NULL; | |
6997 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
6998 /* Special case for Web Explorer, it requires file:/// instead |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
6999 * of file:// so I am handling it here. |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7000 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7001 if(len > 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7002 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7003 if(stricmp(&browser[len], "explore.exe") == 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7004 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7005 int newlen, z; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7006 newurl = alloca(strlen(url) + 2); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7007 sprintf(newurl, "file:///%s", &url[7]); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7008 newlen = strlen(newurl); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7009 for(z=8;z<(newlen-8);z++) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7010 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7011 if(newurl[z] == '|') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7012 newurl[z] = ':'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7013 if(newurl[z] == '/') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7014 newurl[z] = '\\'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7015 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7016 execargs[1] = newurl; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7017 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7018 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7019 |
3 | 7020 return dw_exec(browser, DW_EXEC_GUI, execargs); |
7021 } | |
7022 | |
7023 /* | |
7024 * Returns a pointer to a static buffer which containes the | |
7025 * current user directory. Or the root directory (C:\ on | |
7026 * OS/2 and Windows). | |
7027 */ | |
7028 char *dw_user_dir(void) | |
7029 { | |
7030 static char _user_dir[1024] = ""; | |
7031 | |
7032 if(!_user_dir[0]) | |
7033 { | |
7034 char *home = getenv("HOME"); | |
7035 | |
7036 if(home) | |
7037 strcpy(_user_dir, home); | |
7038 else | |
7039 strcpy(_user_dir, "C:\\"); | |
7040 } | |
7041 return _user_dir; | |
7042 } | |
7043 | |
7044 /* | |
7045 * Call a function from the window (widget)'s context. | |
7046 * Parameters: | |
7047 * handle: Window handle of the widget. | |
7048 * function: Function pointer to be called. | |
7049 * data: Pointer to the data to be passed to the function. | |
7050 */ | |
7051 void dw_window_function(HWND handle, void *function, void *data) | |
7052 { | |
7053 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data); | |
7054 } | |
7055 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7056 /* Functions for managing the user data lists that are associated with |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7057 * a given window handle. Used in dw_window_set_data() and |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7058 * dw_window_get_data(). |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7059 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7060 UserData *find_userdata(UserData **root, char *varname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7061 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7062 UserData *tmp = *root; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7063 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7064 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7065 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7066 if(stricmp(tmp->varname, varname) == 0) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7067 return tmp; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7068 tmp = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7069 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7070 return NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7071 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7072 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7073 int new_userdata(UserData **root, char *varname, void *data) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7074 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7075 UserData *new = find_userdata(root, varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7076 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7077 if(new) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7078 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7079 new->data = data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7080 return TRUE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7081 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7082 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7083 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7084 new = malloc(sizeof(UserData)); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7085 if(new) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7086 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7087 new->varname = strdup(varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7088 new->data = data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7089 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7090 new->next = NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7091 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7092 if (!*root) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7093 *root = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7094 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7095 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7096 UserData *prev = NULL, *tmp = *root; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7097 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7098 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7099 prev = tmp; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7100 tmp = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7101 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7102 if(prev) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7103 prev->next = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7104 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7105 *root = new; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7106 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7107 return TRUE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7108 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7109 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7110 return FALSE; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7111 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7112 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7113 int remove_userdata(UserData **root, char *varname, int all) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7114 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7115 UserData *prev = NULL, *tmp = *root; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7116 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7117 while(tmp) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7118 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7119 if(all || stricmp(tmp->varname, varname) == 0) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7120 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7121 if(!prev) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7122 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7123 free(tmp->varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7124 free(tmp); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7125 *root = NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7126 return 0; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7127 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7128 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7129 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7130 prev->next = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7131 free(tmp->varname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7132 free(tmp); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7133 return 0; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7134 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7135 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7136 tmp = tmp->next; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7137 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7138 return 0; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7139 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7140 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7141 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7142 * Add a named user data item to a window handle. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7143 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7144 * window: Window handle of signal to be called back. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7145 * dataname: A string pointer identifying which signal to be hooked. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7146 * data: User data to be passed to the handler function. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7147 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7148 void dw_window_set_data(HWND window, char *dataname, void *data) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7149 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7150 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7151 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7152 if(blah) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7153 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7154 if(data) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7155 new_userdata(&(blah->root), dataname, data); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7156 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7157 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7158 if(dataname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7159 remove_userdata(&(blah->root), dataname, FALSE); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7160 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7161 remove_userdata(&(blah->root), NULL, TRUE); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7162 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7163 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7164 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7165 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7166 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7167 * Gets a named user data item to a window handle. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7168 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7169 * window: Window handle of signal to be called back. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7170 * dataname: A string pointer identifying which signal to be hooked. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7171 * data: User data to be passed to the handler function. |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7172 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7173 void *dw_window_get_data(HWND window, char *dataname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7174 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7175 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7176 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7177 if(blah && blah->root && dataname) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7178 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7179 UserData *ud = find_userdata(&(blah->root), dataname); |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7180 if(ud) |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7181 return ud->data; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7182 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7183 return NULL; |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7184 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7185 |
3 | 7186 #ifndef NO_SIGNALS |
7187 /* | |
7188 * Add a callback to a window event. | |
7189 * Parameters: | |
7190 * window: Window handle of signal to be called back. | |
7191 * signame: A string pointer identifying which signal to be hooked. | |
7192 * sigfunc: The pointer to the function to be used as the callback. | |
7193 * data: User data to be passed to the handler function. | |
7194 */ | |
7195 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) | |
7196 { | |
7197 ULONG message = 0L; | |
7198 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7199 if(strcmp(signame, "lose-focus") == 0) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7200 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7201 char tmpbuf[100]; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7202 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7203 WinQueryClassName(window, 99, tmpbuf); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7204 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7205 if(strncmp(tmpbuf, "#2", 3) == 0) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7206 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7207 HENUM henum = WinBeginEnumWindows(window); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7208 HWND child = WinGetNextWindow(henum); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7209 WinEndEnumWindows(henum); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7210 if(child) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7211 window = child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7212 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7213 } |
3 | 7214 if(window && signame && sigfunc) |
7215 { | |
7216 if((message = _findsigmessage(signame)) != 0) | |
7217 _new_signal(message, window, sigfunc, data); | |
7218 } | |
7219 } | |
7220 | |
7221 /* | |
7222 * Removes callbacks for a given window with given name. | |
7223 * Parameters: | |
7224 * window: Window handle of callback to be removed. | |
7225 */ | |
7226 void dw_signal_disconnect_by_name(HWND window, char *signame) | |
7227 { | |
7228 SignalHandler *prev = NULL, *tmp = Root; | |
7229 ULONG message; | |
7230 | |
7231 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | |
7232 return; | |
7233 | |
7234 while(tmp) | |
7235 { | |
7236 if(tmp->window == window && tmp->message == message) | |
7237 { | |
7238 if(prev) | |
7239 { | |
7240 prev->next = tmp->next; | |
7241 free(tmp); | |
7242 tmp = prev->next; | |
7243 } | |
7244 else | |
7245 { | |
7246 Root = tmp->next; | |
7247 free(tmp); | |
7248 tmp = Root; | |
7249 } | |
7250 } | |
7251 else | |
7252 { | |
7253 prev = tmp; | |
7254 tmp = tmp->next; | |
7255 } | |
7256 } | |
7257 } | |
7258 | |
7259 /* | |
7260 * Removes all callbacks for a given window. | |
7261 * Parameters: | |
7262 * window: Window handle of callback to be removed. | |
7263 */ | |
7264 void dw_signal_disconnect_by_window(HWND window) | |
7265 { | |
7266 SignalHandler *prev = NULL, *tmp = Root; | |
7267 | |
7268 while(tmp) | |
7269 { | |
7270 if(tmp->window == window) | |
7271 { | |
7272 if(prev) | |
7273 { | |
7274 prev->next = tmp->next; | |
7275 free(tmp); | |
7276 tmp = prev->next; | |
7277 } | |
7278 else | |
7279 { | |
7280 Root = tmp->next; | |
7281 free(tmp); | |
7282 tmp = Root; | |
7283 } | |
7284 } | |
7285 else | |
7286 { | |
7287 prev = tmp; | |
7288 tmp = tmp->next; | |
7289 } | |
7290 } | |
7291 } | |
7292 | |
7293 /* | |
7294 * Removes all callbacks for a given window with specified data. | |
7295 * Parameters: | |
7296 * window: Window handle of callback to be removed. | |
7297 * data: Pointer to the data to be compared against. | |
7298 */ | |
7299 void dw_signal_disconnect_by_data(HWND window, void *data) | |
7300 { | |
7301 SignalHandler *prev = NULL, *tmp = Root; | |
7302 | |
7303 while(tmp) | |
7304 { | |
7305 if(tmp->window == window && tmp->data == data) | |
7306 { | |
7307 if(prev) | |
7308 { | |
7309 prev->next = tmp->next; | |
7310 free(tmp); | |
7311 tmp = prev->next; | |
7312 } | |
7313 else | |
7314 { | |
7315 Root = tmp->next; | |
7316 free(tmp); | |
7317 tmp = Root; | |
7318 } | |
7319 } | |
7320 else | |
7321 { | |
7322 prev = tmp; | |
7323 tmp = tmp->next; | |
7324 } | |
7325 } | |
7326 } | |
7327 #endif | |
7328 | |
7329 #ifdef TEST | |
7330 HWND mainwindow, | |
7331 listbox, | |
7332 okbutton, | |
7333 cancelbutton, | |
7334 lbbox, | |
7335 stext, | |
7336 buttonbox, | |
7337 testwindow, | |
7338 testbox, | |
7339 testok, | |
7340 testcancel, | |
7341 testbox2, | |
7342 testok2, | |
7343 testcancel2, | |
7344 notebook; | |
7345 int count = 2; | |
7346 | |
7347 #ifdef USE_FILTER | |
7348 /* Do any handling you need in the filter function */ | |
7349 LONG testfilter(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
7350 { | |
7351 switch(msg) | |
7352 { | |
7353 case WM_COMMAND: | |
7354 switch (COMMANDMSG(&msg)->cmd) | |
7355 { | |
7356 case 1001L: | |
7357 case 1002L: | |
7358 dw_window_destroy(mainwindow);; | |
7359 count--; | |
7360 break; | |
7361 case 1003L: | |
7362 case 1004L: | |
7363 dw_window_destroy(testwindow);; | |
7364 count--; | |
7365 break; | |
7366 } | |
7367 if(!count) | |
7368 exit(0); | |
7369 break; | |
7370 } | |
7371 /* Return -1 to allow the default handlers to return. */ | |
7372 return TRUE; | |
7373 } | |
7374 #else | |
7375 int test_callback(HWND window, void *data) | |
7376 { | |
7377 dw_window_destroy((HWND)data); | |
7378 /* Return -1 to allow the default handlers to return. */ | |
7379 count--; | |
7380 if(!count) | |
7381 exit(0); | |
7382 return -1; | |
7383 } | |
7384 #endif | |
7385 | |
7386 /* | |
7387 * Let's demonstrate the functionality of this library. :) | |
7388 */ | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
7389 int main(int argc, char *argv[]) |
3 | 7390 { |
7391 ULONG flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | | |
7392 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; | |
7393 int pageid; | |
7394 | |
58
5c66a108aa47
Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
55
diff
changeset
|
7395 dw_init(TRUE, argc, argv); |
3 | 7396 |
7397 /* Try a little server dialog. :) */ | |
7398 mainwindow = dw_window_new(HWND_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); | |
7399 | |
7400 lbbox = dw_box_new(BOXVERT, 10); | |
7401 | |
7402 dw_box_pack_start(mainwindow, lbbox, 0, 0, TRUE, TRUE, 0); | |
7403 | |
7404 stext = dw_text_new("Choose a server:", 0); | |
7405 | |
7406 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); | |
7407 | |
7408 dw_box_pack_start(lbbox, stext, 130, 15, FALSE, FALSE, 10); | |
7409 | |
7410 listbox = dw_listbox_new(100L, FALSE); | |
7411 | |
7412 dw_box_pack_start(lbbox, listbox, 130, 200, TRUE, TRUE, 10); | |
7413 | |
7414 buttonbox = dw_box_new(BOXHORZ, 0); | |
7415 | |
7416 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); | |
7417 | |
7418 okbutton = dw_button_new("Ok", 1001L); | |
7419 | |
7420 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, TRUE, 5); | |
7421 | |
7422 cancelbutton = dw_button_new("Cancel", 1002L); | |
7423 | |
7424 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, TRUE, 5); | |
7425 | |
7426 /* Set some nice fonts and colors */ | |
7427 dw_window_set_color(lbbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7428 dw_window_set_color(buttonbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7429 dw_window_set_font(stext, "9.WarpSans"); | |
7430 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
7431 dw_window_set_font(listbox, "9.WarpSans"); | |
7432 dw_window_set_font(okbutton, "9.WarpSans"); | |
7433 dw_window_set_font(cancelbutton, "9.WarpSans"); | |
7434 | |
7435 dw_window_show(mainwindow); | |
7436 | |
7437 dw_window_set_usize(mainwindow, 170, 340); | |
7438 | |
7439 /* Another small example */ | |
7440 flStyle |= FCF_MINMAX | FCF_SIZEBORDER; | |
7441 | |
7442 testwindow = dw_window_new(HWND_DESKTOP, "Wow a test dialog! :) yay!", flStyle); | |
7443 | |
7444 testbox = dw_box_new(BOXVERT, 0); | |
7445 | |
7446 dw_box_pack_start(testwindow, testbox, 0, 0, TRUE, TRUE, 0); | |
7447 | |
7448 notebook = dw_notebook_new(1010L, TRUE); | |
7449 | |
7450 dw_box_pack_start(testbox, notebook, 100, 100, TRUE, TRUE, 0); | |
7451 | |
7452 testbox = dw_box_new(BOXVERT, 10); | |
7453 | |
7454 pageid = dw_notebook_page_new(notebook, 0L, FALSE); | |
7455 | |
7456 dw_notebook_page_set_text(notebook, pageid, "Test page"); | |
7457 dw_notebook_page_set_status_text(notebook, pageid, "Test page"); | |
7458 | |
7459 dw_notebook_pack(notebook, pageid, testbox); | |
7460 | |
7461 testok = dw_button_new("Ok", 1003L); | |
7462 | |
7463 dw_box_pack_start(testbox, testok, 60, 40, TRUE, TRUE, 10); | |
7464 | |
7465 testcancel = dw_button_new("Cancel", 1004L); | |
7466 | |
7467 dw_box_pack_start(testbox, testcancel, 60, 40, TRUE, TRUE, 10); | |
7468 | |
7469 testbox2 = dw_box_new(BOXHORZ, 0); | |
7470 | |
7471 dw_box_pack_start(testbox, testbox2, 0, 0, TRUE, TRUE, 0); | |
7472 | |
7473 testok2 = dw_button_new("Ok", 1003L); | |
7474 | |
7475 dw_box_pack_start(testbox2, testok2, 60, 40, TRUE, TRUE, 10); | |
7476 | |
7477 dw_box_pack_splitbar_start(testbox2); | |
7478 | |
7479 testcancel2 = dw_button_new("Cancel", 1004L); | |
7480 | |
7481 dw_box_pack_start(testbox2, testcancel2, 60, 40, TRUE, TRUE, 10); | |
7482 | |
7483 /* Set some nice fonts and colors */ | |
7484 dw_window_set_color(testbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7485 dw_window_set_color(testbox2, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7486 dw_window_set_font(testok, "9.WarpSans"); | |
7487 dw_window_set_font(testcancel, "9.WarpSans"); | |
7488 dw_window_set_font(testok2, "9.WarpSans"); | |
7489 dw_window_set_font(testcancel2, "9.WarpSans"); | |
7490 | |
7491 dw_window_show(testwindow); | |
7492 | |
7493 #ifdef USE_FILTER | |
7494 dw_main(0L, (void *)testfilter); | |
7495 #else | |
7496 /* Setup the function callbacks */ | |
7497 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7498 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7499 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7500 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7501 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7502 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7503 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7504 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7505 | |
7506 dw_main(0L, NULL); | |
7507 #endif | |
7508 | |
7509 return 0; | |
7510 } | |
7511 #endif |