Mercurial > dwindows
annotate os2/dw.c @ 108:108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
more visually appealing.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 18 Sep 2002 11:53:14 +0000 |
parents | babc1ea53d79 |
children | bb039d7407f0 |
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); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
30 void _do_resize(Box *thisbox, int x, int y); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
31 |
3 | 32 char ClassName[] = "dynamicwindows"; |
33 char SplitbarClassName[] = "dwsplitbar"; | |
34 char DefaultFont[] = "9.WarpSans"; | |
35 | |
36 /* this is the callback handle for the window procedure | |
37 * make sure you always match the calling convention! | |
38 */ | |
39 int (* EXPENTRY filterfunc)(HWND, ULONG, MPARAM, MPARAM) = 0L; | |
40 | |
41 HAB dwhab = 0; | |
42 HMQ dwhmq = 0; | |
43 DWTID _dwtid = 0; | |
44 LONG _foreground = 0xAAAAAA, _background = 0; | |
45 | |
46 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE; | |
47 PRECORDCORE pCore = NULL; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
48 ULONG aulBuffer[4]; |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
49 HWND lasthcnr = 0, lastitem = 0, popup = 0; |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
50 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
51 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) |
3 | 52 |
53 #ifndef min | |
54 #define min(a, b) (((a < b) ? a : b)) | |
55 #endif | |
56 | |
57 #ifdef DWDEBUG | |
58 FILE *f; | |
59 | |
60 void reopen(void) | |
61 { | |
62 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
|
63 f = fopen("dw.log", "a+"); |
3 | 64 } |
65 #endif | |
66 | |
67 static LONG lColor[SPLITBAR_WIDTH] = | |
68 { | |
69 DW_CLR_BLACK, | |
70 DW_CLR_PALEGRAY, | |
71 DW_CLR_WHITE | |
72 }; | |
73 | |
74 #ifdef NO_SIGNALS | |
75 #define USE_FILTER | |
76 #else | |
77 typedef struct _sighandler | |
78 { | |
79 struct _sighandler *next; | |
80 ULONG message; | |
81 HWND window; | |
82 void *signalfunction; | |
83 void *data; | |
84 | |
85 } SignalHandler; | |
86 | |
87 SignalHandler *Root = NULL; | |
88 | |
89 typedef struct | |
90 { | |
91 ULONG message; | |
92 char name[30]; | |
93 | |
94 } SignalList; | |
95 | |
96 /* 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
|
97 #define SIGNALMAX 15 |
3 | 98 |
99 SignalList SignalTranslate[SIGNALMAX] = { | |
100 { WM_SIZE, "configure_event" }, | |
101 { WM_CHAR, "key_press_event" }, | |
102 { WM_BUTTON1DOWN, "button_press_event" }, | |
103 { WM_BUTTON1UP, "button_release_event"}, | |
104 { WM_MOUSEMOVE, "motion_notify_event" }, | |
105 { WM_CLOSE, "delete_event" }, | |
106 { WM_PAINT, "expose_event" }, | |
107 { WM_COMMAND, "clicked" }, | |
108 { CN_ENTER, "container-select" }, | |
109 { CN_CONTEXTMENU, "container-context" }, | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
110 { 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
|
111 { 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
|
112 { 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
|
113 { 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
|
114 { SLN_SLIDERTRACK, "value_changed" } |
3 | 115 }; |
116 | |
117 /* This function adds a signal handler callback into the linked list. | |
118 */ | |
119 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data) | |
120 { | |
121 SignalHandler *new = malloc(sizeof(SignalHandler)); | |
122 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
123 #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
|
124 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
|
125 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
|
126 #endif |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
127 |
3 | 128 new->message = message; |
129 new->window = window; | |
130 new->signalfunction = signalfunction; | |
131 new->data = data; | |
132 new->next = NULL; | |
133 | |
134 if (!Root) | |
135 Root = new; | |
136 else | |
137 { | |
138 SignalHandler *prev = NULL, *tmp = Root; | |
139 while(tmp) | |
140 { | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
141 if(tmp->message == message && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
142 tmp->window == window && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
143 tmp->signalfunction == signalfunction) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
144 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
145 tmp->data = data; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
146 free(new); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
147 return; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
148 } |
3 | 149 prev = tmp; |
150 tmp = tmp->next; | |
151 } | |
152 if(prev) | |
153 prev->next = new; | |
154 else | |
155 Root = new; | |
156 } | |
157 } | |
158 | |
159 /* Finds the message number for a given signal name */ | |
160 ULONG _findsigmessage(char *signame) | |
161 { | |
162 int z; | |
163 | |
164 for(z=0;z<SIGNALMAX;z++) | |
165 { | |
166 if(stricmp(signame, SignalTranslate[z].name) == 0) | |
167 return SignalTranslate[z].message; | |
168 } | |
169 return 0L; | |
170 } | |
171 #endif | |
172 | |
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
|
173 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
|
174 { |
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 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
|
176 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
|
177 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
|
178 |
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 } 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
|
180 |
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
|
181 |
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
|
182 /* 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
|
183 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
|
184 { |
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 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
|
186 |
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 /* 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
|
188 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
|
189 { |
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 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
|
191 } |
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 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
|
193 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
|
194 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
|
195 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
196 |
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
|
197 /* 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
|
198 * 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
|
199 */ |
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 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
|
201 { |
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 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
|
203 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
|
204 |
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 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
|
206 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
|
207 { |
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 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
|
209 |
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 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
|
211 |
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 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
|
213 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
|
214 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
|
215 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
|
216 |
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 _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
|
218 } |
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 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
|
220 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
|
221 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
222 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
223 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
|
224 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
225 HENUM henum; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
226 HWND child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
227 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
228 #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
|
229 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
|
230 #endif |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
231 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
232 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
|
233 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
|
234 _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
|
235 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
236 WinEndEnumWindows(henum); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
237 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
238 |
3 | 239 /* This function removes and handlers on windows and frees |
240 * the user memory allocated to it. | |
241 */ | |
242 void _free_window_memory(HWND handle) | |
243 { | |
244 HENUM henum; | |
245 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
|
246 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); |
3 | 247 |
248 #ifndef NO_SIGNALS | |
249 dw_signal_disconnect_by_window(handle); | |
250 #endif | |
251 | |
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
|
252 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
|
253 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
254 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
|
255 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
|
256 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
|
257 } |
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
|
258 |
3 | 259 henum = WinBeginEnumWindows(handle); |
260 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
261 _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
|
262 |
3 | 263 WinEndEnumWindows(henum); |
264 return; | |
265 } | |
266 | |
267 /* This function returns 1 if the window (widget) handle | |
268 * passed to it is a valid window that can gain input focus. | |
269 */ | |
270 int _validate_focus(HWND handle) | |
271 { | |
272 char tmpbuf[100]; | |
273 | |
274 if(!handle) | |
275 return 0; | |
276 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
277 if(!WinIsWindowEnabled(handle)) |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
278 return 0; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
279 |
3 | 280 WinQueryClassName(handle, 99, tmpbuf); |
281 | |
282 /* These are the window classes which can | |
283 * obtain input focus. | |
284 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
285 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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */ |
3 | 293 return 1; |
294 return 0; | |
295 } | |
296 | |
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
|
297 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) |
3 | 298 { |
299 int z; | |
300 static HWND lasthwnd, firsthwnd; | |
301 static int finish_searching; | |
302 | |
303 /* Start is 2 when we have cycled completely and | |
304 * need to set the focus to the last widget we found | |
305 * that was valid. | |
306 */ | |
307 if(start == 2) | |
308 { | |
309 if(lasthwnd) | |
310 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
311 return 0; | |
312 } | |
313 | |
314 /* Start is 1 when we are entering the function | |
315 * for the first time, it is zero when entering | |
316 * the function recursively. | |
317 */ | |
318 if(start == 1) | |
319 { | |
320 lasthwnd = handle; | |
321 finish_searching = 0; | |
322 firsthwnd = 0; | |
323 } | |
324 | |
325 /* Vertical boxes are inverted on OS/2 */ | |
326 if(box->type == BOXVERT) | |
327 { | |
328 for(z=0;z<box->count;z++) | |
329 { | |
330 if(box->items[z].type == TYPEBOX) | |
331 { | |
332 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); | |
333 | |
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
|
334 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 335 return 1; |
336 } | |
337 else | |
338 { | |
339 if(box->items[z].hwnd == handle) | |
340 { | |
341 if(lasthwnd == handle && firsthwnd) | |
342 WinSetFocus(HWND_DESKTOP, firsthwnd); | |
343 else if(lasthwnd == handle && !firsthwnd) | |
344 finish_searching = 1; | |
345 else | |
346 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
347 | |
348 /* If we aren't looking for the last handle, | |
349 * return immediately. | |
350 */ | |
351 if(!finish_searching) | |
352 return 1; | |
353 } | |
354 if(_validate_focus(box->items[z].hwnd)) | |
355 { | |
356 /* Start is 3 when we are looking for the | |
357 * first valid item in the layout. | |
358 */ | |
359 if(start == 3) | |
360 { | |
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
|
361 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
|
362 { |
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 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
|
364 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
|
365 } |
3 | 366 } |
367 | |
368 if(!firsthwnd) | |
369 firsthwnd = box->items[z].hwnd; | |
370 | |
371 lasthwnd = box->items[z].hwnd; | |
372 } | |
373 else | |
374 { | |
375 char tmpbuf[100] = ""; | |
376 | |
377 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
|
378 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 379 { |
380 Box *notebox; | |
381 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, | |
382 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); | |
383 | |
384 if(page) | |
385 { | |
386 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); | |
387 | |
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
|
388 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 389 return 1; |
390 } | |
391 } | |
392 } | |
393 } | |
394 } | |
395 } | |
396 else | |
397 { | |
398 for(z=box->count-1;z>-1;z--) | |
399 { | |
400 if(box->items[z].type == TYPEBOX) | |
401 { | |
402 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); | |
403 | |
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
|
404 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 405 return 1; |
406 } | |
407 else | |
408 { | |
409 if(box->items[z].hwnd == handle) | |
410 { | |
411 if(lasthwnd == handle && firsthwnd) | |
412 WinSetFocus(HWND_DESKTOP, firsthwnd); | |
413 else if(lasthwnd == handle && !firsthwnd) | |
414 finish_searching = 1; | |
415 else | |
416 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
417 | |
418 /* If we aren't looking for the last handle, | |
419 * return immediately. | |
420 */ | |
421 if(!finish_searching) | |
422 return 1; | |
423 } | |
424 if(_validate_focus(box->items[z].hwnd)) | |
425 { | |
426 /* Start is 3 when we are looking for the | |
427 * first valid item in the layout. | |
428 */ | |
429 if(start == 3) | |
430 { | |
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
|
431 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
|
432 { |
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 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
|
434 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
|
435 } |
3 | 436 } |
437 | |
438 if(!firsthwnd) | |
439 firsthwnd = box->items[z].hwnd; | |
440 | |
441 lasthwnd = box->items[z].hwnd; | |
442 } | |
443 else | |
444 { | |
445 char tmpbuf[100] = ""; | |
446 | |
447 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
|
448 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 449 { |
450 Box *notebox; | |
451 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, | |
452 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); | |
453 | |
454 if(page) | |
455 { | |
456 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); | |
457 | |
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
|
458 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
3 | 459 return 1; |
460 } | |
461 } | |
462 } | |
463 } | |
464 } | |
465 } | |
466 return 0; | |
467 } | |
468 | |
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
|
469 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
|
470 { |
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 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
|
472 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
|
473 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
|
474 |
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 /* 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
|
476 * 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
|
477 * 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
|
478 */ |
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 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
|
480 { |
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 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
|
482 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
|
483 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
|
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 |
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 /* 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
|
487 * 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
|
488 * 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
|
489 */ |
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 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
|
491 { |
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 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
|
493 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
|
494 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
|
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 |
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 /* 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
|
498 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
|
499 { |
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 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
|
501 { |
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 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
|
503 { |
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 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
|
505 |
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 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
|
507 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
|
508 } |
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 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
|
510 { |
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 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
|
512 { |
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 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
|
514 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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 |
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 /* 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
|
521 * 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
|
522 */ |
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 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
|
524 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
|
525 } |
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 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
|
527 { |
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 /* 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
|
529 * 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
|
530 */ |
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 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
|
532 { |
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 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
|
534 { |
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 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
|
536 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
|
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 |
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 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
|
541 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
|
542 |
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 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
|
544 } |
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 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
|
546 { |
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 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
|
548 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
549 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
|
550 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
|
551 { |
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 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
|
553 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
|
554 (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
|
555 |
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 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
|
557 { |
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 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
|
559 |
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 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
|
561 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
|
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 } |
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 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
|
569 { |
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 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
|
571 { |
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 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
|
573 { |
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 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
|
575 |
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 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
|
577 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
|
578 } |
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 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
|
580 { |
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 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
|
582 { |
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 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
|
584 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
|
585 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
|
586 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
|
587 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
|
588 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
|
589 |
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 /* 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
|
591 * 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
|
592 */ |
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 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
|
594 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
|
595 } |
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 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
|
597 { |
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 /* 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
|
599 * 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
|
600 */ |
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 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
|
602 { |
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 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
|
604 { |
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 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
|
606 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
|
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 |
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 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
|
611 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
|
612 |
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 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
|
614 } |
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 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
|
616 { |
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 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
|
618 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
619 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
|
620 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
|
621 { |
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 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
|
623 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
|
624 (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
|
625 |
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 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
|
627 { |
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 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
|
629 |
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 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
|
631 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
|
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 } |
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 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
|
639 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
640 |
3 | 641 /* This function finds the first widget in the |
642 * layout and moves the current focus to it. | |
643 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
644 int _initial_focus(HWND handle) |
3 | 645 { |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
646 Box *thisbox = NULL; |
3 | 647 HWND box; |
648 | |
649 box = WinWindowFromID(handle, FID_CLIENT); | |
650 if(box) | |
651 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
|
652 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
653 return 1; |
3 | 654 |
655 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
|
656 _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
|
657 return 0; |
3 | 658 } |
659 | |
660 /* This function finds the current widget in the | |
661 * layout and moves the current focus to the next item. | |
662 */ | |
663 void _shift_focus(HWND handle) | |
664 { | |
665 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
|
666 HWND box, lastbox = _toplevel_window(handle); |
3 | 667 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
668 box = WinWindowFromID(lastbox, FID_CLIENT); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
669 if(box) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
670 thisbox = WinQueryWindowPtr(box, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
671 else |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
672 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
673 |
3 | 674 if(thisbox) |
675 { | |
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
|
676 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
|
677 _focus_check_box(thisbox, handle, 2, 0); |
3 | 678 } |
679 } | |
680 | |
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
|
681 /* 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
|
682 * 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
|
683 */ |
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 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
|
685 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
686 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
|
687 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
|
688 |
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 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
|
690 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
|
691 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
|
692 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
|
693 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
|
694 |
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 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
|
696 { |
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 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
|
698 _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
|
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 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
701 |
3 | 702 /* ResetWindow: |
703 * Resizes window to the exact same size to trigger | |
704 * recalculation of frame. | |
705 */ | |
706 void _ResetWindow(HWND hwndFrame) | |
707 { | |
708 SWP swp; | |
709 | |
710 WinQueryWindowPos(hwndFrame, &swp); | |
711 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy-1, SWP_SIZE); | |
712 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy, SWP_SIZE); | |
713 } | |
714 | |
715 /* This function will recursively search a box and add up the total height of it */ | |
716 void _count_size(HWND box, int type, int *xsize, int *xorigsize) | |
717 { | |
718 int size = 0, origsize = 0, z; | |
719 Box *tmp = WinQueryWindowPtr(box, QWP_USER); | |
720 | |
721 if(!tmp) | |
722 { | |
723 *xsize = *xorigsize = 0; | |
724 return; | |
725 } | |
726 | |
727 if(type == tmp->type) | |
728 { | |
729 /* If the box is going in the direction we want, then we | |
730 * return the entire sum of the items. | |
731 */ | |
732 for(z=0;z<tmp->count;z++) | |
733 { | |
734 if(tmp->items[z].type == TYPEBOX) | |
735 { | |
736 int s, os; | |
737 | |
738 _count_size(tmp->items[z].hwnd, type, &s, &os); | |
739 size += s; | |
740 origsize += os; | |
741 } | |
742 else | |
743 { | |
744 size += (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); | |
745 origsize += (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); | |
746 } | |
747 } | |
748 } | |
749 else | |
750 { | |
751 /* If the box is not going in the direction we want, then we only | |
752 * want to return the maximum value. | |
753 */ | |
754 int tmpsize = 0, tmporigsize = 0; | |
755 | |
756 for(z=0;z<tmp->count;z++) | |
757 { | |
758 if(tmp->items[z].type == TYPEBOX) | |
759 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); | |
760 else | |
761 { | |
762 tmpsize = (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); | |
763 tmporigsize = (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); | |
764 } | |
765 | |
766 if(tmpsize > size) | |
767 size = tmpsize; | |
768 } | |
769 } | |
770 | |
771 *xsize = size; | |
772 *xorigsize = origsize; | |
773 } | |
774 | |
775 | |
776 /* Function: TrackRectangle | |
777 * Abstract: Tracks given rectangle. | |
778 * | |
779 * If rclBounds is NULL, then track rectangle on entire desktop. | |
780 * rclTrack is in window coorditates and will be mapped to | |
781 * desktop. | |
782 */ | |
783 | |
784 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) | |
785 { | |
786 TRACKINFO track; | |
787 APIRET rc; | |
788 | |
789 track.cxBorder = 1; | |
790 track.cyBorder = 1; | |
791 track.cxGrid = 1; | |
792 track.cyGrid = 1; | |
793 track.cxKeyboard = 8; | |
794 track.cyKeyboard = 8; | |
795 | |
796 if(!rclTrack) | |
797 return FALSE; | |
798 | |
799 if(rclBounds) | |
800 { | |
801 track.rclBoundary = *rclBounds; | |
802 } | |
803 else | |
804 { | |
805 track.rclBoundary.yTop = | |
806 track.rclBoundary.xRight = 3000; | |
807 track.rclBoundary.yBottom = | |
808 track.rclBoundary.xLeft = -3000; | |
809 } | |
810 | |
811 track.rclTrack = *rclTrack; | |
812 | |
813 WinMapWindowPoints(hwndBase, | |
814 HWND_DESKTOP, | |
815 (PPOINTL)&track.rclTrack, | |
816 2); | |
817 | |
818 track.ptlMinTrackSize.x = track.rclTrack.xRight | |
819 - track.rclTrack.xLeft; | |
820 track.ptlMinTrackSize.y = track.rclTrack.yTop | |
821 - track.rclTrack.yBottom; | |
822 track.ptlMaxTrackSize.x = track.rclTrack.xRight | |
823 - track.rclTrack.xLeft; | |
824 track.ptlMaxTrackSize.y = track.rclTrack.yTop | |
825 - track.rclTrack.yBottom; | |
826 | |
827 track.fs = TF_MOVE | TF_ALLINBOUNDARY; | |
828 | |
829 rc = WinTrackRect(HWND_DESKTOP, 0, &track); | |
830 | |
831 if(rc) | |
832 *rclTrack = track.rclTrack; | |
833 | |
834 return rc; | |
835 } | |
836 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
837 void _check_resize_notebook(HWND hwnd) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
838 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
839 char tmpbuf[100]; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
840 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
841 WinQueryClassName(hwnd, 99, tmpbuf); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
842 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
843 /* If we have a notebook we resize the page again. */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
844 if(strncmp(tmpbuf, "#40", 4)==0) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
845 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
846 unsigned long x, y, width, height; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
847 ULONG page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, 0, MPFROM2SHORT(BKA_FIRST, BKA_MAJOR)); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
848 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
849 while(page) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
850 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
851 HWND pagehwnd = (HWND)WinSendMsg(hwnd, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(page), 0); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
852 RECTL rc; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
853 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
854 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
855 if(pagebox) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
856 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
857 dw_window_get_pos_size(hwnd, &x, &y, &width, &height); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
858 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
859 rc.xLeft = x; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
860 rc.yBottom = y; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
861 rc.xRight = x + width; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
862 rc.yTop = y + height; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
863 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
864 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
865 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
866 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
867 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
868 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR)); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
869 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
870 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
871 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
872 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
873 |
3 | 874 /* This function calculates how much space the widgets and boxes require |
875 * and does expansion as necessary. | |
876 */ | |
877 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy, | |
878 int pass, int *usedpadx, int *usedpady) | |
879 { | |
880 int z, currentx = 0, currenty = 0; | |
881 int uymax = 0, uxmax = 0; | |
882 int upymax = 0, upxmax = 0; | |
883 /* Used for the SIZEEXPAND */ | |
884 int nux = *usedx, nuy = *usedy; | |
885 int nupx = *usedpadx, nupy = *usedpady; | |
886 | |
887 (*usedx) += (thisbox->pad * 2); | |
888 (*usedy) += (thisbox->pad * 2); | |
889 | |
890 for(z=0;z<thisbox->count;z++) | |
891 { | |
892 if(thisbox->items[z].type == TYPEBOX) | |
893 { | |
894 int initialx, initialy; | |
895 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
896 | |
897 initialx = x - (*usedx); | |
898 initialy = y - (*usedy); | |
899 | |
900 if(tmp) | |
901 { | |
902 int newx, newy; | |
903 int nux = *usedx, nuy = *usedy; | |
904 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2); | |
905 | |
906 /* On the second pass we know how big the box needs to be and how | |
907 * much space we have, so we can calculate a ratio for the new box. | |
908 */ | |
909 if(pass == 2) | |
910 { | |
911 int deep = *depth + 1; | |
912 | |
913 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy); | |
914 | |
915 tmp->upx = upx - *usedpadx; | |
916 tmp->upy = upy - *usedpady; | |
917 | |
918 newx = x - nux; | |
919 newy = y - nuy; | |
920 | |
921 tmp->width = thisbox->items[z].width = initialx - newx; | |
922 tmp->height = thisbox->items[z].height = initialy - newy; | |
923 | |
924 tmp->parentxratio = thisbox->xratio; | |
925 tmp->parentyratio = thisbox->yratio; | |
926 | |
927 tmp->parentpad = tmp->pad; | |
928 | |
929 /* Just in case */ | |
930 tmp->xratio = thisbox->xratio; | |
931 tmp->yratio = thisbox->yratio; | |
932 | |
933 #ifdef DWDEBUG | |
934 if(pass > 1) | |
935 { | |
936 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", | |
937 *depth, thisbox->items[z].width, thisbox->items[z].height, nux, nuy, tmp->upx, tmp->upy, tmp->xratio, tmp->yratio); | |
938 reopen(); | |
939 } | |
940 #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
|
941 |
3 | 942 if(thisbox->type == BOXVERT) |
943 { | |
944 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
945 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)))); | |
946 } | |
947 else | |
948 { | |
949 if((thisbox->items[z].width-tmp->upx)!=0) | |
950 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); | |
951 } | |
952 if(thisbox->type == BOXHORZ) | |
953 { | |
954 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | |
955 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)))); | |
956 } | |
957 else | |
958 { | |
959 if((thisbox->items[z].height-tmp->upy)!=0) | |
960 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); | |
961 } | |
962 | |
963 nux = *usedx; nuy = *usedy; | |
964 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | |
965 } | |
966 | |
967 (*depth)++; | |
968 | |
969 #ifdef DWDEBUG | |
970 if(pass > 1) | |
971 { | |
972 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", | |
973 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio); | |
974 reopen(); | |
975 } | |
976 #endif | |
977 | |
978 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); | |
979 | |
980 (*depth)--; | |
981 | |
982 newx = x - nux; | |
983 newy = y - nuy; | |
984 | |
985 tmp->minwidth = thisbox->items[z].width = initialx - newx; | |
986 tmp->minheight = thisbox->items[z].height = initialy - newy; | |
987 | |
988 #ifdef DWDEBUG | |
989 if(pass > 1) | |
990 { | |
991 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", | |
992 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, thisbox->items[z].width, thisbox->items[z].height); | |
993 reopen(); | |
994 } | |
995 #endif | |
996 } | |
997 } | |
998 | |
999 if(pass > 1 && *depth > 0) | |
1000 { | |
1001 if(thisbox->type == BOXVERT) | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1002 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1003 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
|
1004 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1005 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1006 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
|
1007 } |
3 | 1008 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1009 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1010 if(thisbox->minwidth-thisbox->upx == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1011 thisbox->items[z].xratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1012 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1013 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
|
1014 } |
3 | 1015 |
1016 if(thisbox->type == BOXHORZ) | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1017 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1018 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
|
1019 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1020 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1021 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
|
1022 } |
3 | 1023 else |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1024 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1025 if(thisbox->minheight-thisbox->upy == 0) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1026 thisbox->items[z].yratio = 1.0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1027 else |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
1028 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
|
1029 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1030 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1031 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
|
1032 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1033 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
|
1034 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1035 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
|
1036 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1037 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
|
1038 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
|
1039 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1040 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1041 |
3 | 1042 #ifdef DWDEBUG |
1043 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", | |
1044 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); | |
1045 reopen(); | |
1046 #endif | |
1047 } | |
1048 else | |
1049 { | |
1050 thisbox->items[z].xratio = thisbox->xratio; | |
1051 thisbox->items[z].yratio = thisbox->yratio; | |
1052 } | |
1053 | |
1054 if(thisbox->type == BOXVERT) | |
1055 { | |
1056 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) | |
1057 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); | |
1058 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1059 { | |
1060 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax) | |
1061 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1062 } | |
1063 else | |
1064 { | |
1065 if(thisbox->items[z].pad*2 > upxmax) | |
1066 upxmax = thisbox->items[z].pad*2; | |
1067 } | |
1068 } | |
1069 else | |
1070 { | |
1071 if(thisbox->items[z].width == -1) | |
1072 { | |
1073 /* figure out how much space this item requires */ | |
1074 /* thisbox->items[z].width = */ | |
1075 } | |
1076 else | |
1077 { | |
1078 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
1079 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1080 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1081 else | |
1082 (*usedpadx) += thisbox->items[z].pad*2; | |
1083 } | |
1084 } | |
1085 if(thisbox->type == BOXHORZ) | |
1086 { | |
1087 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) | |
1088 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); | |
1089 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1090 { | |
1091 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax) | |
1092 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1093 } | |
1094 else | |
1095 { | |
1096 if(thisbox->items[z].pad*2 > upymax) | |
1097 upymax = thisbox->items[z].pad*2; | |
1098 } | |
1099 } | |
1100 else | |
1101 { | |
1102 if(thisbox->items[z].height == -1) | |
1103 { | |
1104 /* figure out how much space this item requires */ | |
1105 /* thisbox->items[z].height = */ | |
1106 } | |
1107 else | |
1108 { | |
1109 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
1110 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1111 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1112 else | |
1113 (*usedpady) += thisbox->items[z].pad*2; | |
1114 } | |
1115 } | |
1116 } | |
1117 | |
1118 (*usedx) += uxmax; | |
1119 (*usedy) += uymax; | |
1120 (*usedpadx) += upxmax; | |
1121 (*usedpady) += upymax; | |
1122 | |
1123 currentx += thisbox->pad; | |
1124 currenty += thisbox->pad; | |
1125 | |
1126 #ifdef DWDEBUG | |
1127 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", | |
1128 *depth, *usedx, *usedy, *usedpadx, *usedpady, currentx, currenty, uxmax, uymax); | |
1129 reopen(); | |
1130 #endif | |
1131 | |
1132 /* The second pass is for expansion and actual placement. */ | |
1133 if(pass > 1) | |
1134 { | |
1135 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | |
1136 for(z=0;z<thisbox->count;z++) | |
1137 { | |
1138 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT) | |
1139 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); | |
1140 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ) | |
1141 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); | |
1142 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | |
1143 if(thisbox->items[z].type == TYPEBOX) | |
1144 { | |
1145 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
1146 | |
1147 if(tmp) | |
1148 { | |
1149 if(*depth > 0) | |
1150 { | |
1151 if(thisbox->type == BOXVERT) | |
1152 { | |
1153 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)))); | |
1154 tmp->width = thisbox->items[z].width; | |
1155 } | |
1156 if(thisbox->type == BOXHORZ) | |
1157 { | |
1158 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)))); | |
1159 tmp->height = thisbox->items[z].height; | |
1160 } | |
1161 } | |
1162 | |
1163 (*depth)++; | |
1164 | |
1165 #ifdef DWDEBUG | |
1166 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", | |
1167 *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); | |
1168 reopen(); | |
1169 #endif | |
1170 | |
1171 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); | |
1172 | |
1173 (*depth)--; | |
1174 | |
1175 } | |
1176 } | |
1177 } | |
1178 | |
1179 for(z=0;z<(thisbox->count);z++) | |
1180 { | |
1181 int height = thisbox->items[z].height; | |
1182 int width = thisbox->items[z].width; | |
1183 int pad = thisbox->items[z].pad; | |
1184 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
|
1185 int vectorx, vectory; |
3 | 1186 |
1187 /* When upxmax != pad*2 then ratios are incorrect. */ | |
1188 vectorx = (int)((width*thisbox->items[z].xratio)-width); | |
1189 vectory = (int)((height*thisbox->items[z].yratio)-height); | |
1190 | |
1191 if(width > 0 && height > 0) | |
1192 { | |
1193 char tmpbuf[100]; | |
1194 /* This is a hack to fix rounding of the sizing */ | |
1195 if(*depth == 0) | |
1196 { | |
1197 vectorx++; | |
1198 vectory++; | |
1199 } | |
1200 | |
1201 /* If this item isn't going to expand... reset the vectors to 0 */ | |
1202 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1203 vectory = 0; | |
1204 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1205 vectorx = 0; | |
1206 | |
1207 WinQueryClassName(handle, 99, tmpbuf); | |
1208 | |
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
|
1209 if(strncmp(tmpbuf, "#2", 3)==0) |
3 | 1210 { |
1211 /* Make the combobox big enough to drop down. :) */ | |
1212 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100, | |
1213 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1214 } | |
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
|
1215 else if(strncmp(tmpbuf, "#6", 3)==0) |
3 | 1216 { |
1217 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ | |
1218 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, | |
1219 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1220 } | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1221 else if(strncmp(tmpbuf, "#40", 5)==0) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1222 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1223 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1224 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1225 _check_resize_notebook(handle); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1226 } |
3 | 1227 else |
1228 { | |
1229 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, | |
1230 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1231 if(thisbox->items[z].type == TYPEBOX) | |
1232 { | |
1233 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER); | |
1234 | |
1235 if(boxinfo && boxinfo->grouphwnd) | |
1236 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
|
1237 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE); |
3 | 1238 |
1239 } | |
1240 | |
1241 } | |
1242 | |
1243 #ifdef DWDEBUG | |
1244 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", | |
1245 *depth, currentx, currenty, pad, width, height, vectorx, vectory,thisbox->type == BOXHORZ ? "Horizontal" : "Vertical"); | |
1246 reopen(); | |
1247 #endif | |
1248 | |
1249 if(thisbox->type == BOXHORZ) | |
1250 currentx += width + vectorx + (pad * 2); | |
1251 if(thisbox->type == BOXVERT) | |
1252 currenty += height + vectory + (pad * 2); | |
1253 } | |
1254 } | |
1255 } | |
1256 return 0; | |
1257 } | |
1258 | |
1259 void _do_resize(Box *thisbox, int x, int y) | |
1260 { | |
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
|
1261 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
|
1262 { |
3 | 1263 if(thisbox) |
1264 { | |
1265 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; | |
1266 | |
1267 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady); | |
1268 | |
1269 if(usedx-usedpadx == 0 || usedy-usedpady == 0) | |
1270 return; | |
1271 | |
1272 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); | |
1273 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); | |
1274 | |
1275 #ifdef DWDEBUG | |
1276 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", | |
1277 x, y, usedx, usedy, usedpadx, usedpady, thisbox->xratio, thisbox->yratio); | |
1278 reopen(); | |
1279 #endif | |
1280 | |
1281 usedx = usedy = usedpadx = usedpady = depth = 0; | |
1282 | |
1283 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); | |
1284 #ifdef DWDEBUG | |
1285 fprintf(f, "WM_SIZE Resize Box Pass 2\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d\r\n", | |
1286 x, y, usedx, usedy, usedpadx, usedpady); | |
1287 reopen(); | |
1288 #endif | |
1289 } | |
1290 } | |
1291 } | |
1292 | |
1293 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ | |
1294 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1295 { | |
1296 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
|
1297 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
|
1298 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
|
1299 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1300 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
|
1301 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
|
1302 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
|
1303 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1304 if(thisbox && !thisbox->titlebar) |
3 | 1305 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1306 switch(msg) |
3 | 1307 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1308 case WM_QUERYTRACKINFO: |
3 | 1309 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1310 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
|
1311 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1312 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
|
1313 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
|
1314 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
|
1315 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
|
1316 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1317 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
|
1318 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1319 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
|
1320 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
|
1321 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1322 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
|
1323 } |
3 | 1324 } |
1325 } | |
1326 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1327 |
3 | 1328 if(blah && *blah) |
1329 { | |
1330 PFNWP myfunc = *blah; | |
1331 return myfunc(hWnd, msg, mp1, mp2); | |
1332 } | |
1333 | |
1334 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1335 } | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1336 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1337 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
|
1338 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1339 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
|
1340 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1341 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
|
1342 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
|
1343 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
|
1344 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
|
1345 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
|
1346 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1347 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1348 /* 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
|
1349 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
|
1350 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1351 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
|
1352 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1353 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
|
1354 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
|
1355 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
|
1356 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
|
1357 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
|
1358 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1359 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1360 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
|
1361 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1362 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
|
1363 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1364 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
|
1365 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
|
1366 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
|
1367 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
|
1368 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
|
1369 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1370 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1371 /* 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
|
1372 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
|
1373 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1374 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
|
1375 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1376 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
|
1377 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
|
1378 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
|
1379 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
|
1380 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
|
1381 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1382 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1383 /* This procedure handles drawing of a status border */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1384 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
|
1385 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1386 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1387 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1388 if(blah && *blah) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1389 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1390 PFNWP myfunc = *blah; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1391 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1392 switch(msg) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1393 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1394 case WM_PAINT: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1395 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1396 HPS hpsPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1397 RECTL rclPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1398 char buf[1024]; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1399 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1400 hpsPaint = WinBeginPaint(hWnd, 0, 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1401 WinQueryWindowRect(hWnd, &rclPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1402 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1403 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1404 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
|
1405 _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
|
1406 _Left(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1407 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1408 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
|
1409 _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
|
1410 _Bottom(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1411 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1412 WinQueryWindowText(hWnd, 1024, buf); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1413 rclPaint.xLeft += 3; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1414 rclPaint.xRight--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1415 rclPaint.yTop--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1416 rclPaint.yBottom++; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1417 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1418 GpiSetColor(hpsPaint, CLR_BLACK); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1419 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
|
1420 WinEndPaint(hpsPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1421 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1422 return (MRESULT)TRUE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1423 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1424 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1425 return myfunc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1426 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1427 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1428 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1429 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1430 |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1431 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
|
1432 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1433 char tmpbuf[100]; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1434 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1435 WinQueryClassName(handle, 99, tmpbuf); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1436 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1437 /* 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
|
1438 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1439 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1440 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
|
1441 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1442 /* 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
|
1443 SignalHandler *tmp = Root; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1444 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1445 /* 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
|
1446 while(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1447 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1448 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
|
1449 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1450 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
|
1451 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1452 /* 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
|
1453 if(tmp->window == handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1454 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1455 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
|
1456 tmp = NULL; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1457 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1458 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1459 if(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1460 tmp= tmp->next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1461 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1462 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1463 else |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1464 WinSetFocus(HWND_DESKTOP, handle); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1465 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1466 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1467 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
|
1468 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1469 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
|
1470 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1471 switch(msg) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1472 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1473 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
|
1474 _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
|
1475 break; |
97
24cf41bb75ff
Fixed a problem with the ESC key in comboboxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
1476 case WM_CHAR: |
24cf41bb75ff
Fixed a problem with the ESC key in comboboxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
1477 /* A Similar problem to the MLE, if ESC just return */ |
24cf41bb75ff
Fixed a problem with the ESC key in comboboxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
1478 if(SHORT1FROMMP(mp2) == 283) |
24cf41bb75ff
Fixed a problem with the ESC key in comboboxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
1479 return TRUE; |
24cf41bb75ff
Fixed a problem with the ESC key in comboboxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
94
diff
changeset
|
1480 break; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1481 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1482 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1483 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
|
1484 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
|
1485 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1486 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
|
1487 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1488 |
3 | 1489 /* Originally just intended for entryfields, it now serves as a generic |
1490 * procedure for handling TAB presses to change input focus on controls. | |
1491 */ | |
1492 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1493 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1494 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
|
1495 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
|
1496 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1497 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1498 oldproc = blah->oldproc; |
3 | 1499 |
1500 switch(msg) | |
1501 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1502 case WM_BUTTON1DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1503 case WM_BUTTON2DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1504 case WM_BUTTON3DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1505 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1506 char tmpbuf[100]; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1507 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1508 WinQueryClassName(hWnd, 99, tmpbuf); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1509 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1510 if(strncmp(tmpbuf, "#32", 4)==0) |
38
538db2a48bac
Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1511 _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
|
1512 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1513 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
|
1514 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
|
1515 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1516 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
|
1517 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1518 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
|
1519 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1520 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
|
1521 _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
|
1522 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1523 break; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1524 case WM_SETFOCUS: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1525 _run_event(hWnd, msg, mp1, mp2); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1526 break; |
3 | 1527 case WM_CHAR: |
1528 if(SHORT1FROMMP(mp2) == '\t') | |
1529 { | |
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
|
1530 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
|
1531 _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
|
1532 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
|
1533 _shift_focus(hWnd); |
3 | 1534 return FALSE; |
1535 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1536 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
|
1537 _click_default(blah->clickdefault); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1538 /* When you hit escape we get this value and the |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1539 * window hangs for reasons unknown. (in an MLE) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1540 */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1541 else if(SHORT1FROMMP(mp2) == 283) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1542 return TRUE; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1543 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1544 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1545 case WM_SIZE: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1546 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1547 char tmpbuf[100]; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1548 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1549 WinQueryClassName(hWnd, 99, tmpbuf); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1550 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1551 /* If it's a slider... make sure it shows the correct value */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1552 if(strncmp(tmpbuf, "#38", 4)==0) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1553 WinPostMsg(hWnd, WM_USER+7, 0, 0); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1554 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1555 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1556 case WM_USER+7: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1557 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1558 int pos = (int)dw_window_get_data(hWnd, "_dw_slider_value"); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1559 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)pos); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1560 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1561 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1562 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1563 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1564 if(oldproc) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1565 return oldproc(hWnd, msg, mp1, mp2); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1566 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1567 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1568 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1569 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1570 int _dw_int_pos(HWND hwnd) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1571 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1572 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value"); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1573 int range = dw_percent_query_range(hwnd); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1574 float fpos = (float)pos; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1575 float frange = (float)range; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1576 float fnew = (fpos/1000.0)*frange; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1577 return (int)fnew; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1578 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1579 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1580 void _dw_int_set(HWND hwnd, int pos) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1581 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1582 int inew, range = dw_percent_query_range(hwnd); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1583 float fpos = (float)pos; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1584 float frange = (float)range; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1585 float fnew = (fpos/frange)*1000.0; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1586 inew = (int)fnew; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1587 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1588 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1589 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1590 /* Handle size changes in the percent class */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1591 MRESULT EXPENTRY _percentproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1592 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1593 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1594 PFNWP oldproc = 0; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1595 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1596 if(blah) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1597 oldproc = blah->oldproc; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1598 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1599 switch(msg) |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1600 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1601 case WM_SIZE: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1602 WinPostMsg(hWnd, WM_USER+7, 0, 0); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1603 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1604 case WM_USER+7: |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1605 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd)); |
3 | 1606 break; |
1607 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1608 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1609 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1610 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1611 |
1612 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1613 } | |
1614 | |
1615 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN | |
1616 * flag enabled, and also handle TABs to switch input focus. | |
1617 */ | |
1618 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1619 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1620 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
|
1621 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
|
1622 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1623 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1624 oldproc = blah->oldproc; |
3 | 1625 |
1626 switch(msg) | |
1627 { | |
1628 case WM_CHAR: | |
1629 if(SHORT1FROMMP(mp2) == '\t') | |
1630 { | |
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
|
1631 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
|
1632 _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
|
1633 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
|
1634 _shift_focus(hWnd); |
3 | 1635 return FALSE; |
1636 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1637 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
|
1638 _click_default(blah->clickdefault); |
3 | 1639 break; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1640 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
|
1641 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
|
1642 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
|
1643 _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
|
1644 break; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1645 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
|
1646 _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
|
1647 break; |
3 | 1648 case WM_PAINT: |
1649 { | |
1650 HWND parent = WinQueryWindow(hWnd, QW_PARENT); | |
1651 ULONG bcol, av[32]; | |
1652 HPS hpsPaint; | |
1653 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */ | |
1654 unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6; | |
1655 | |
1656 WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT); | |
1657 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); | |
1658 | |
1659 hpsPaint = WinGetPS(hWnd); | |
1660 GpiSetColor(hpsPaint, CLR_PALEGRAY); | |
1661 | |
1662 ptl.x = 0; | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
1663 ptl.y = 0; |
3 | 1664 GpiMove(hpsPaint, &ptl); |
1665 | |
1666 ptl.x = width; | |
1667 ptl.y = height - thumbheight; | |
1668 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); | |
1669 | |
1670 WinReleasePS(hpsPaint); | |
1671 } | |
1672 break; | |
1673 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1674 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1675 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1676 |
1677 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1678 } | |
1679 | |
1680 void _GetPPFont(HWND hwnd, char *buff) | |
1681 { | |
1682 ULONG AttrFound; | |
1683 BYTE AttrValue[128]; | |
1684 ULONG cbRetLen; | |
1685 | |
1686 cbRetLen = WinQueryPresParam(hwnd, | |
1687 PP_FONTNAMESIZE, | |
1688 0, | |
1689 &AttrFound, | |
1690 sizeof(AttrValue), | |
1691 &AttrValue, | |
1692 QPF_NOINHERIT); | |
1693 | |
1694 if(PP_FONTNAMESIZE == AttrFound && cbRetLen) | |
1695 { | |
1696 memcpy(buff, AttrValue, cbRetLen); | |
1697 } | |
1698 } | |
1699 | |
1700 /* Returns height of specified window. */ | |
1701 int _get_height(HWND handle) | |
1702 { | |
1703 unsigned long height; | |
1704 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); | |
1705 return (int)height; | |
1706 } | |
1707 | |
1708 /* Find the height of the frame a desktop style window is sitting on */ | |
1709 int _get_frame_height(HWND handle) | |
1710 { | |
1711 while(handle) | |
1712 { | |
1713 HWND client; | |
1714 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) | |
1715 { | |
1716 return _get_height(WinQueryWindow(handle, QW_PARENT)); | |
1717 } | |
1718 handle = WinQueryWindow(handle, QW_PARENT); | |
1719 } | |
1720 return dw_screen_height(); | |
1721 } | |
1722 | |
1723 #ifndef NO_SIGNALS | |
1724 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1725 { | |
1726 int result = -1; | |
1727 SignalHandler *tmp = Root; | |
1728 ULONG origmsg = msg; | |
1729 | |
1730 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) | |
1731 msg = WM_BUTTON1DOWN; | |
1732 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) | |
1733 msg = WM_BUTTON1UP; | |
1734 | |
1735 /* Find any callbacks for this function */ | |
1736 while(tmp) | |
1737 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1738 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1) |
3 | 1739 { |
1740 switch(msg) | |
1741 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1742 case WM_SETFOCUS: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1743 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1744 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
|
1745 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1746 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
|
1747 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1748 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
|
1749 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1750 result = setfocusfunc(tmp->window, tmp->data); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1751 tmp = NULL; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1752 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1753 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1754 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1755 break; |
3 | 1756 case WM_SIZE: |
1757 { | |
1758 int (*sizefunc)(HWND, int, int, void *) = (int (*)(HWND, int, int, void *))tmp->signalfunction; | |
1759 | |
1760 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) | |
1761 { | |
1762 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data); | |
1763 tmp = NULL; | |
1764 } | |
1765 } | |
1766 break; | |
1767 case WM_BUTTON1DOWN: | |
1768 { | |
1769 POINTS pts = (*((POINTS*)&mp1)); | |
1770 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; | |
1771 | |
1772 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
1773 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
1774 int button = 0; |
3 | 1775 |
1776 switch(origmsg) | |
1777 { | |
1778 case WM_BUTTON1DOWN: | |
1779 button = 1; | |
1780 break; | |
1781 case WM_BUTTON2DOWN: | |
1782 button = 2; | |
1783 break; | |
1784 case WM_BUTTON3DOWN: | |
1785 button = 3; | |
1786 break; | |
1787 } | |
1788 | |
1789 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data); | |
1790 tmp = NULL; | |
1791 } | |
1792 } | |
1793 break; | |
1794 case WM_BUTTON1UP: | |
1795 { | |
1796 POINTS pts = (*((POINTS*)&mp1)); | |
1797 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; | |
1798 | |
1799 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
1800 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
1801 int button = 0; |
3 | 1802 |
1803 switch(origmsg) | |
1804 { | |
1805 case WM_BUTTON1UP: | |
1806 button = 1; | |
1807 break; | |
1808 case WM_BUTTON2UP: | |
1809 button = 2; | |
1810 break; | |
1811 case WM_BUTTON3UP: | |
1812 button = 3; | |
1813 break; | |
1814 } | |
1815 | |
1816 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); | |
1817 tmp = NULL; | |
1818 } | |
1819 } | |
1820 break; | |
1821 case WM_MOUSEMOVE: | |
1822 { | |
1823 int (*motionfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction; | |
1824 | |
1825 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
1826 { | |
1827 int keys = 0; | |
1828 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1); | |
1829 | |
1830 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) | |
1831 keys = DW_BUTTON1_MASK; | |
1832 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) | |
1833 keys |= DW_BUTTON2_MASK; | |
1834 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) | |
1835 keys |= DW_BUTTON3_MASK; | |
1836 | |
1837 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data); | |
1838 tmp = NULL; | |
1839 } | |
1840 } | |
1841 break; | |
1842 case WM_CHAR: | |
1843 { | |
1844 int (*keypressfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction; | |
1845 | |
1846 if(hWnd == tmp->window) | |
1847 { | |
1848 result = keypressfunc(tmp->window, SHORT1FROMMP(mp2), tmp->data); | |
1849 tmp = NULL; | |
1850 } | |
1851 } | |
1852 break; | |
1853 case WM_CLOSE: | |
1854 { | |
1855 int (*closefunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; | |
1856 | |
1857 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT)) | |
1858 { | |
1859 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
|
1860 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
|
1861 result = FALSE; |
3 | 1862 tmp = NULL; |
1863 } | |
1864 } | |
1865 break; | |
1866 case WM_PAINT: | |
1867 { | |
1868 HPS hps; | |
1869 DWExpose exp; | |
1870 int (*exposefunc)(HWND, DWExpose *, void *) = (int (*)(HWND, DWExpose *, void *))tmp->signalfunction; | |
1871 RECTL rc; | |
1872 | |
1873 if(hWnd == tmp->window) | |
1874 { | |
1875 int height = _get_height(hWnd); | |
1876 | |
1877 hps = WinBeginPaint(hWnd, 0L, &rc); | |
1878 exp.x = rc.xLeft; | |
1879 exp.y = height - rc.yTop - 1; | |
1880 exp.width = rc.xRight - rc. xLeft; | |
1881 exp.height = rc.yTop - rc.yBottom; | |
1882 result = exposefunc(hWnd, &exp, tmp->data); | |
1883 WinEndPaint(hps); | |
1884 } | |
1885 } | |
1886 break; | |
1887 case WM_COMMAND: | |
1888 { | |
1889 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction; | |
1890 ULONG command = COMMANDMSG(&msg)->cmd; | |
1891 | |
1892 if(tmp->window < 65536 && command == tmp->window) | |
1893 { | |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
1894 result = clickfunc(popup ? popup : tmp->window, tmp->data); |
3 | 1895 tmp = NULL; |
1896 } | |
1897 } | |
1898 break; | |
1899 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
|
1900 if(tmp->message == SHORT2FROMMP(mp1) || (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE)) |
3 | 1901 { |
1902 switch(SHORT2FROMMP(mp1)) | |
1903 { | |
1904 case CN_ENTER: | |
1905 { | |
1906 int (*containerselectfunc)(HWND, char *, void *) = (int (*)(HWND, char *, void *))tmp->signalfunction; | |
1907 int id = SHORT1FROMMP(mp1); | |
1908 HWND conthwnd = dw_window_from_id(hWnd, id); | |
1909 char *text = NULL; | |
1910 | |
1911 if(mp2) | |
1912 { | |
1913 PRECORDCORE pre; | |
1914 | |
1915 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; | |
1916 if(pre) | |
1917 text = pre->pszIcon; | |
1918 } | |
1919 | |
1920 if(tmp->window == conthwnd) | |
1921 { | |
1922 result = containerselectfunc(tmp->window, text, tmp->data); | |
1923 tmp = NULL; | |
1924 } | |
1925 } | |
1926 break; | |
1927 case CN_CONTEXTMENU: | |
1928 { | |
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
|
1929 int (*containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (*)(HWND, char *, int, int, void *, void *))tmp->signalfunction; |
3 | 1930 int id = SHORT1FROMMP(mp1); |
1931 HWND conthwnd = dw_window_from_id(hWnd, id); | |
1932 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
|
1933 void *user = NULL; |
3 | 1934 LONG x,y; |
1935 | |
1936 if(mp2) | |
1937 { | |
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
|
1938 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
|
1939 |
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
|
1940 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
|
1941 |
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
|
1942 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
|
1943 user = pci->user; |
3 | 1944 } |
1945 | |
1946 dw_pointer_query_pos(&x, &y); | |
1947 | |
1948 if(tmp->window == conthwnd) | |
1949 { | |
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
|
1950 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
|
1951 { |
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
|
1952 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
|
1953 |
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
|
1954 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
|
1955 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
|
1956 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
|
1957 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
|
1958 _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
|
1959 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
|
1960 } |
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
|
1961 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); |
3 | 1962 tmp = NULL; |
1963 } | |
1964 } | |
1965 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
|
1966 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
|
1967 { |
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
|
1968 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
|
1969 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
|
1970 |
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
|
1971 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
|
1972 { |
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
|
1973 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
|
1974 |
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
|
1975 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
|
1976 { |
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
|
1977 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
|
1978 { |
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
|
1979 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
|
1980 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1981 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
|
1982 { |
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
|
1983 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
|
1984 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1985 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
|
1986 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1987 lasthcnr = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1988 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1989 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1990 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1991 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1992 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
|
1993 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
|
1994 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
|
1995 } |
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
|
1996 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
|
1997 } |
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
|
1998 } |
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
|
1999 } |
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
|
2000 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
|
2001 } |
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
|
2002 } |
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
|
2003 break; |
3 | 2004 case LN_SELECT: |
2005 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2006 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
|
2007 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2008 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
|
2009 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2010 if(strncmp(classbuf, "#38", 4) == 0) |
3 | 2011 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2012 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
|
2013 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2014 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
|
2015 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2016 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
|
2017 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
|
2018 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
|
2019 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
|
2020 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2021 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
|
2022 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
|
2023 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
|
2024 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2025 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
|
2026 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2027 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2028 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2029 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2030 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
|
2031 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
|
2032 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
|
2033 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
|
2034 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2035 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) |
3 | 2036 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2037 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
|
2038 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
|
2039 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2040 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
|
2041 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2042 _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
|
2043 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2044 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
|
2045 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2046 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
|
2047 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2048 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
|
2049 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2050 /* 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
|
2051 * 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
|
2052 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2053 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
|
2054 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
|
2055 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2056 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
|
2057 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
|
2058 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2059 else |
3 | 2060 result = listboxselectfunc(tmp->window, index, tmp->data); |
2061 | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2062 _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
|
2063 tmp = NULL; |
3 | 2064 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2065 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2066 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2067 break; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2068 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
|
2069 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2070 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
|
2071 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2072 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
|
2073 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2074 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
|
2075 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
|
2076 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
|
2077 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
|
2078 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
2079 dw_window_set_data(tmp->window, "_dw_slider_value", (void *)ulValue); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2080 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
|
2081 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
|
2082 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
|
2083 } |
3 | 2084 tmp = NULL; |
2085 } | |
2086 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2087 |
3 | 2088 break; |
2089 } | |
2090 } | |
2091 break; | |
2092 } | |
2093 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2094 |
3 | 2095 if(tmp) |
2096 tmp = tmp->next; | |
2097 | |
2098 } | |
2099 | |
2100 return (MRESULT)result; | |
2101 } | |
2102 #endif | |
2103 | |
2104 /* Handles control messages sent to the box (owner). */ | |
2105 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2106 { | |
2107 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
2108 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2109 #ifndef NO_SIGNALS |
3 | 2110 switch(msg) |
2111 { | |
2112 case WM_CONTROL: | |
2113 _run_event(hWnd, msg, mp1, mp2); | |
2114 break; | |
2115 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2116 #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
|
2117 |
3 | 2118 if(blah && blah->oldproc) |
2119 return blah->oldproc(hWnd, msg, mp1, mp2); | |
2120 | |
2121 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2122 } | |
2123 | |
2124 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | |
2125 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2126 { | |
2127 int result = -1; | |
2128 static int command_active = 0; | |
2129 void (* windowfunc)(PVOID) = 0L; | |
2130 | |
2131 if(filterfunc) | |
2132 result = filterfunc(hWnd, msg, mp1, mp2); | |
2133 | |
2134 #ifndef NO_SIGNALS | |
2135 if(result == -1 && !command_active) | |
2136 { | |
2137 /* Make sure we don't end up in infinite recursion */ | |
2138 command_active = 1; | |
2139 | |
2140 result = (int)_run_event(hWnd, msg, mp1, mp2); | |
2141 | |
2142 command_active = 0; | |
2143 } | |
2144 #endif | |
2145 | |
2146 /* Now that any handlers are done... do normal processing */ | |
2147 switch( msg ) | |
2148 { | |
2149 case WM_ERASEBACKGROUND: | |
2150 return 0; | |
2151 | |
2152 case WM_PAINT: | |
2153 { | |
2154 HPS hps; | |
2155 RECTL rc; | |
2156 | |
2157 hps = WinBeginPaint( hWnd, 0L, &rc ); | |
2158 WinEndPaint( hps ); | |
2159 break; | |
2160 } | |
2161 | |
2162 case WM_SIZE: | |
2163 { | |
2164 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2165 | |
2166 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2)) | |
2167 return (MPARAM)TRUE; | |
2168 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2169 if(mybox && mybox->flags != DW_MINIMIZED) |
3 | 2170 { |
2171 /* Hide the window when recalculating to reduce | |
2172 * CPU load. | |
2173 */ | |
2174 WinShowWindow(hWnd, FALSE); | |
2175 | |
2176 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); | |
2177 | |
2178 WinShowWindow(hWnd, TRUE); | |
2179 } | |
2180 } | |
2181 break; | |
2182 case WM_MINMAXFRAME: | |
2183 { | |
2184 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2185 SWP *swp = (SWP *)mp1; | |
2186 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2187 if(mybox && (swp->fl & SWP_MINIMIZE)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2188 mybox->flags = DW_MINIMIZED; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2189 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2190 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
|
2191 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2192 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
|
2193 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2194 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
|
2195 } |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2196 |
3 | 2197 if(mybox && (swp->fl & SWP_MAXIMIZE)) |
2198 { | |
2199 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
|
2200 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
|
2201 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2202 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
|
2203 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2204 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
|
2205 return FALSE; |
3 | 2206 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2207 mybox->flags = 0; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2208 |
3 | 2209 /* Hide the window when recalculating to reduce |
2210 * CPU load. | |
2211 */ | |
2212 WinShowWindow(hWnd, FALSE); | |
2213 | |
2214 _do_resize(mybox, swp->cx, swp->cy); | |
2215 | |
2216 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) | |
2217 { | |
2218 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); | |
2219 | |
2220 for(z=0;z<mybox->count;z++) | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
2221 _check_resize_notebook(mybox->items[z].hwnd); |
3 | 2222 |
2223 } | |
2224 | |
2225 WinShowWindow(hWnd, TRUE); | |
2226 } | |
2227 } | |
2228 break; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2229 case WM_CONTROL: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2230 switch(SHORT2FROMMP(mp1)) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2231 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2232 case BKN_PAGESELECTEDPENDING: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2233 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2234 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2235 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
|
2236 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
|
2237 unsigned long x, y, width, height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2238 RECTL rc; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2239 |
21
c6e76b796b28
Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
20
diff
changeset
|
2240 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
|
2241 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2242 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
|
2243 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2244 rc.xLeft = x; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2245 rc.yBottom = y; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2246 rc.xRight = x + width; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2247 rc.yTop = y + height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2248 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2249 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
|
2250 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2251 _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
|
2252 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2253 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2254 break; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2255 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2256 break; |
3 | 2257 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
|
2258 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
|
2259 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2260 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
|
2261 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
|
2262 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2263 break; |
3 | 2264 case WM_USER: |
2265 windowfunc = (void (*)(void *))mp1; | |
2266 | |
2267 if(windowfunc) | |
2268 windowfunc((void *)mp2); | |
2269 break; | |
2270 case WM_CHAR: | |
2271 if(SHORT1FROMMP(mp2) == '\t') | |
2272 { | |
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
|
2273 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
|
2274 _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
|
2275 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
|
2276 _shift_focus(hWnd); |
3 | 2277 return FALSE; |
2278 } | |
2279 break; | |
2280 case WM_DESTROY: | |
2281 /* Free memory before destroying */ | |
2282 _free_window_memory(hWnd); | |
2283 break; | |
2284 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2285 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2286 if(result != -1) |
3 | 2287 return (MRESULT)result; |
2288 else | |
2289 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2290 } | |
2291 | |
2292 void _changebox(Box *thisbox, int percent, int type) | |
2293 { | |
2294 int z; | |
2295 | |
2296 for(z=0;z<thisbox->count;z++) | |
2297 { | |
2298 if(thisbox->items[z].type == TYPEBOX) | |
2299 { | |
2300 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
2301 _changebox(tmp, percent, type); | |
2302 } | |
2303 else | |
2304 { | |
2305 if(type == BOXHORZ) | |
2306 { | |
2307 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2308 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2309 } | |
2310 else | |
2311 { | |
2312 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2313 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2314 } | |
2315 } | |
2316 } | |
2317 } | |
2318 | |
2319 /* This handles any activity on the splitbars (sizers) */ | |
2320 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2321 { | |
2322 HWND hwndFrame = 0; | |
2323 Box *thisbox = 0; | |
2324 | |
2325 hwndFrame = WinQueryWindow(hwnd, QW_PARENT); | |
2326 if(hwndFrame) | |
2327 thisbox = WinQueryWindowPtr(hwndFrame, QWL_USER); | |
2328 | |
2329 switch (msg) | |
2330 { | |
2331 case WM_ACTIVATE: | |
2332 case WM_SETFOCUS: | |
2333 return (MRESULT)(FALSE); | |
2334 | |
2335 case WM_PAINT: | |
2336 { | |
2337 HPS hpsPaint; | |
2338 RECTL rclPaint; | |
2339 POINTL ptlStart[SPLITBAR_WIDTH]; | |
2340 POINTL ptlEnd[SPLITBAR_WIDTH]; | |
2341 USHORT i; | |
2342 | |
2343 hpsPaint = WinBeginPaint(hwnd, 0, 0); | |
2344 WinQueryWindowRect(hwnd, &rclPaint); | |
2345 | |
2346 if(thisbox->type == BOXHORZ) | |
2347 { | |
2348 for(i = 0; i < SPLITBAR_WIDTH; i++) | |
2349 { | |
2350 ptlStart[i].x = rclPaint.xLeft + i; | |
2351 ptlStart[i].y = rclPaint.yTop; | |
2352 | |
2353 ptlEnd[i].x = rclPaint.xLeft + i; | |
2354 ptlEnd[i].y = rclPaint.yBottom; | |
2355 } | |
2356 } | |
2357 else | |
2358 { | |
2359 for(i = 0; i < SPLITBAR_WIDTH; i++) | |
2360 { | |
2361 ptlStart[i].x = rclPaint.xLeft; | |
2362 ptlStart[i].y = rclPaint.yBottom + i; | |
2363 | |
2364 ptlEnd[i].x = rclPaint.xRight; | |
2365 ptlEnd[i].y = rclPaint.yBottom + i; | |
2366 } | |
2367 } | |
2368 | |
2369 for(i = 0; i < SPLITBAR_WIDTH; i++) | |
2370 { | |
2371 GpiSetColor( hpsPaint, lColor[i]); | |
2372 GpiMove(hpsPaint, &ptlStart[i]); | |
2373 GpiLine(hpsPaint, &ptlEnd[i]); | |
2374 } | |
2375 WinEndPaint(hpsPaint); | |
2376 } | |
2377 return MRFROMSHORT(FALSE); | |
2378 | |
2379 case WM_MOUSEMOVE: | |
2380 { | |
2381 if(thisbox->type == BOXHORZ) | |
2382 WinSetPointer(HWND_DESKTOP, | |
2383 WinQuerySysPointer(HWND_DESKTOP, | |
2384 SPTR_SIZEWE, | |
2385 FALSE)); | |
2386 else | |
2387 WinSetPointer(HWND_DESKTOP, | |
2388 WinQuerySysPointer(HWND_DESKTOP, | |
2389 SPTR_SIZENS, | |
2390 FALSE)); | |
2391 } | |
2392 return MRFROMSHORT(FALSE); | |
2393 case WM_BUTTON1DOWN: | |
2394 { | |
2395 APIRET rc; | |
2396 RECTL rclFrame; | |
2397 RECTL rclBounds; | |
2398 RECTL rclStart; | |
2399 USHORT startSize, orig, actual; | |
2400 | |
2401 WinQueryWindowRect(hwnd, &rclFrame); | |
2402 WinQueryWindowRect(hwnd, &rclStart); | |
2403 | |
2404 WinQueryWindowRect(hwndFrame, &rclBounds); | |
2405 | |
2406 WinMapWindowPoints(hwndFrame, HWND_DESKTOP, | |
2407 (PPOINTL)&rclBounds, 2); | |
2408 WinMapWindowPoints(hwnd, HWND_DESKTOP, | |
2409 (PPOINTL)&rclStart, 2); | |
2410 | |
2411 { | |
2412 int z, pastsplitbar = FALSE, found = FALSE; | |
2413 orig = actual = 0; | |
2414 | |
2415 for(z=0;z<thisbox->count;z++) | |
2416 { | |
2417 if(thisbox->items[z].hwnd == hwnd) | |
2418 pastsplitbar = TRUE; | |
2419 else | |
2420 { | |
2421 if(thisbox->type == BOXHORZ) | |
2422 { | |
2423 int tmpwidth, tmporigwidth; | |
2424 | |
2425 if(thisbox->items[z].type == TYPEBOX) | |
2426 _count_size(thisbox->items[z].hwnd, BOXHORZ, &tmpwidth, &tmporigwidth); | |
2427 else | |
2428 { | |
2429 tmpwidth = thisbox->items[z].width; | |
2430 tmporigwidth = thisbox->items[z].origwidth; | |
2431 } | |
2432 | |
2433 if(thisbox->items[z].hsize != SIZESTATIC && tmpwidth > actual && tmporigwidth) | |
2434 { | |
2435 found = pastsplitbar; | |
2436 orig = tmporigwidth; | |
2437 actual = tmpwidth; | |
2438 } | |
2439 } | |
2440 else | |
2441 { | |
2442 int tmpheight, tmporigheight; | |
2443 | |
2444 if(thisbox->items[z].type == TYPEBOX) | |
2445 _count_size(thisbox->items[z].hwnd, BOXVERT, &tmpheight, &tmporigheight); | |
2446 else | |
2447 { | |
2448 tmpheight = thisbox->items[z].height; | |
2449 tmporigheight = thisbox->items[z].origheight; | |
2450 } | |
2451 | |
2452 if(thisbox->items[z].vsize != SIZESTATIC && tmpheight > actual && tmporigheight) | |
2453 { | |
2454 found = pastsplitbar; | |
2455 orig = tmporigheight; | |
2456 actual = tmpheight; | |
2457 } | |
2458 } | |
2459 } | |
2460 } | |
2461 | |
2462 /* If we couldn't determine a valid scale... then abort */ | |
2463 if(!orig || !actual) | |
2464 return MRFROMSHORT(FALSE); | |
2465 | |
2466 if(thisbox->type == BOXHORZ) | |
2467 { | |
2468 if(found) | |
2469 startSize = (rclStart.xLeft - rclBounds.xLeft) | |
2470 * (((float)actual)/((float)orig)); | |
2471 else | |
2472 startSize = (rclStart.xLeft - rclBounds.xLeft) | |
2473 * (((float)orig)/((float)actual)); | |
2474 } | |
2475 else | |
2476 { | |
2477 if(found) | |
2478 startSize = (rclStart.yBottom - rclBounds.yBottom) | |
2479 * (((float)actual)/((float)orig)); | |
2480 else | |
2481 startSize = (rclStart.yBottom - rclBounds.yBottom) | |
2482 * (((float)orig)/((float)actual)); | |
2483 } | |
2484 } | |
2485 | |
2486 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds); | |
2487 | |
2488 if(rc == TRUE) | |
2489 { | |
2490 USHORT usNewRB; | |
2491 USHORT percent; | |
2492 int z; | |
2493 | |
2494 if(thisbox->type == BOXHORZ) | |
2495 { | |
2496 usNewRB = rclFrame.xLeft | |
2497 - rclBounds.xLeft; | |
2498 } | |
2499 else | |
2500 { | |
2501 usNewRB = rclFrame.yBottom | |
2502 - rclBounds.yBottom; | |
2503 } | |
2504 | |
2505 /* We don't want the item to disappear completely */ | |
2506 if(!usNewRB) | |
2507 usNewRB++; | |
2508 | |
2509 if(!startSize) | |
2510 startSize++; | |
2511 | |
2512 percent = (usNewRB*100)/startSize; | |
2513 | |
2514 for(z=0;z<thisbox->count;z++) | |
2515 { | |
2516 if(thisbox->items[z].type == TYPEBOX) | |
2517 { | |
2518 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
|
2519 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2520 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
|
2521 _changebox(tmp, percent, thisbox->type); |
3 | 2522 } |
2523 else | |
2524 { | |
2525 if(thisbox->items[z].hwnd == hwnd) | |
2526 percent = (startSize*100)/usNewRB; | |
2527 | |
2528 if(thisbox->type == BOXHORZ) | |
2529 { | |
2530 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2531 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2532 } | |
2533 else | |
2534 { | |
2535 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2536 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2537 } | |
2538 } | |
2539 } | |
2540 | |
2541 _ResetWindow(WinQueryWindow(hwnd, QW_OWNER)); | |
2542 } | |
2543 } | |
2544 return MRFROMSHORT(FALSE); | |
2545 } | |
2546 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2547 } | |
2548 | |
2549 /* Function: BubbleProc | |
2550 * Abstract: Subclass procedure for bubble help | |
2551 */ | |
2552 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2553 { | |
2554 MRESULT res; | |
2555 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
2556 | |
2557 if(proc) | |
2558 res = proc(hwnd, msg, mp1, mp2); | |
2559 else | |
2560 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2561 | |
2562 if(msg == WM_PAINT) | |
2563 { | |
2564 POINTL ptl; | |
2565 HPS hpsTemp; | |
2566 RECTL rcl; | |
2567 int height, width; | |
2568 | |
2569 WinQueryWindowRect(hwnd, &rcl); | |
2570 height = rcl.yTop - rcl.yBottom - 1; | |
2571 width = rcl.xRight - rcl.xLeft - 1; | |
2572 | |
2573 /* Draw a border around the bubble help */ | |
2574 hpsTemp = WinGetPS(hwnd); | |
2575 GpiSetColor(hpsTemp, DW_CLR_BLACK); | |
2576 ptl.x = ptl.y = 0; | |
2577 GpiMove(hpsTemp, &ptl); | |
2578 ptl.x = 0; | |
2579 ptl.y = height; | |
2580 GpiLine(hpsTemp, &ptl); | |
2581 ptl.x = ptl.y = 0; | |
2582 GpiMove(hpsTemp, &ptl); | |
2583 ptl.y = 0; | |
2584 ptl.x = width; | |
2585 GpiLine(hpsTemp, &ptl); | |
2586 ptl.x = width; | |
2587 ptl.y = height; | |
2588 GpiMove(hpsTemp, &ptl); | |
2589 ptl.x = 0; | |
2590 ptl.y = height; | |
2591 GpiLine(hpsTemp, &ptl); | |
2592 ptl.x = width; | |
2593 ptl.y = height; | |
2594 GpiMove(hpsTemp, &ptl); | |
2595 ptl.y = 0; | |
2596 ptl.x = width; | |
2597 GpiLine(hpsTemp, &ptl); | |
2598 WinReleasePS(hpsTemp); | |
2599 } | |
2600 return res; | |
2601 } | |
2602 | |
2603 /* Function: BtProc | |
2604 * Abstract: Subclass procedure for buttons | |
2605 */ | |
2606 | |
2607 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2608 { | |
2609 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
|
2610 PFNWP oldproc; |
3 | 2611 |
2612 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER); | |
2613 | |
2614 if(!bubble) | |
2615 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2616 | |
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
|
2617 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
|
2618 |
3 | 2619 switch(msg) |
2620 { | |
2621 #ifndef NO_SIGNALS | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2622 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
|
2623 if(mp2) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2624 _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
|
2625 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2626 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2627 break; |
3 | 2628 case WM_BUTTON1UP: |
2629 { | |
2630 SignalHandler *tmp = Root; | |
2631 | |
2632 if(WinIsWindowEnabled(hwnd)) | |
2633 { | |
2634 /* Find any callbacks for this function */ | |
2635 while(tmp) | |
2636 { | |
2637 if(tmp->message == WM_COMMAND) | |
2638 { | |
2639 /* Make sure it's the right window, and the right ID */ | |
2640 if(tmp->window == hwnd) | |
2641 { | |
2642 /* Due to the fact that if we run the function | |
2643 * here, finishing actions on the button will occur | |
2644 * after we run the signal handler. So we post the | |
2645 * message so the button can finish what it needs to | |
2646 * do before we run our handler. | |
2647 */ | |
2648 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2649 tmp = NULL; | |
2650 } | |
2651 } | |
2652 if(tmp) | |
2653 tmp= tmp->next; | |
2654 } | |
2655 } | |
2656 } | |
2657 break; | |
2658 case WM_USER: | |
2659 { | |
2660 SignalHandler *tmp = (SignalHandler *)mp1; | |
2661 int (*clickfunc)(HWND, void *) = NULL; | |
2662 | |
2663 if(tmp) | |
2664 { | |
2665 clickfunc = (int (*)(HWND, void *))tmp->signalfunction; | |
2666 | |
2667 clickfunc(tmp->window, tmp->data); | |
2668 } | |
2669 } | |
2670 break; | |
2671 #endif | |
2672 case WM_CHAR: | |
2673 { | |
2674 #ifndef NO_SIGNALS | |
2675 /* A button press should also occur for an ENTER or SPACE press | |
2676 * while the button has the active input focus. | |
2677 */ | |
2678 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') | |
2679 { | |
2680 SignalHandler *tmp = Root; | |
2681 | |
2682 /* Find any callbacks for this function */ | |
2683 while(tmp) | |
2684 { | |
2685 if(tmp->message == WM_COMMAND) | |
2686 { | |
2687 /* Make sure it's the right window, and the right ID */ | |
2688 if(tmp->window == hwnd) | |
2689 { | |
2690 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2691 tmp = NULL; | |
2692 } | |
2693 } | |
2694 if(tmp) | |
2695 tmp= tmp->next; | |
2696 } | |
2697 } | |
2698 #endif | |
2699 if(SHORT1FROMMP(mp2) == '\t') | |
2700 { | |
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
|
2701 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
|
2702 _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
|
2703 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
|
2704 _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
|
2705 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
|
2706 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
|
2707 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2708 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
|
2709 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2710 _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
|
2711 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
|
2712 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
2713 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
|
2714 { |
3 | 2715 _shift_focus(hwnd); |
2716 return FALSE; | |
2717 } | |
2718 } | |
2719 break; | |
2720 case 0x041f: | |
2721 if (hwndBubble) | |
2722 { | |
2723 WinDestroyWindow(hwndBubble); | |
2724 hwndBubble = 0; | |
2725 } | |
2726 break; | |
2727 | |
2728 case 0x041e: | |
2729 | |
2730 if(!*bubble->bubbletext) | |
2731 break; | |
2732 | |
2733 if(hwndBubble) | |
2734 { | |
2735 WinDestroyWindow(hwndBubble); | |
2736 hwndBubble = 0; | |
2737 } | |
2738 | |
2739 if(!hwndBubble) | |
2740 { | |
2741 HPS hpsTemp = 0; | |
2742 LONG lHight; | |
2743 LONG lWidth; | |
2744 POINTL txtPointl[TXTBOX_COUNT]; | |
2745 POINTL ptlWork = {0,0}; | |
2746 ULONG ulColor = DW_CLR_YELLOW; | |
2747 void *blah; | |
2748 | |
2749 hwndBubbleLast = hwnd; | |
2750 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
2751 WC_STATIC, | |
2752 "", | |
2753 SS_TEXT | | |
2754 DT_CENTER | | |
2755 DT_VCENTER, | |
2756 0,0,0,0, | |
2757 HWND_DESKTOP, | |
2758 HWND_TOP, | |
2759 0, | |
2760 NULL, | |
2761 NULL); | |
2762 | |
2763 WinSetPresParam(hwndBubble, | |
2764 PP_FONTNAMESIZE, | |
2765 sizeof(DefaultFont), | |
2766 DefaultFont); | |
2767 | |
2768 | |
2769 WinSetPresParam(hwndBubble, | |
2770 PP_BACKGROUNDCOLORINDEX, | |
2771 sizeof(ulColor), | |
2772 &ulColor); | |
2773 | |
2774 WinSetWindowText(hwndBubble, | |
2775 bubble->bubbletext); | |
2776 | |
2777 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
2778 | |
2779 hpsTemp = WinGetPS(hwndBubble); | |
2780 GpiQueryTextBox(hpsTemp, | |
2781 strlen(bubble->bubbletext), | |
2782 bubble->bubbletext, | |
2783 TXTBOX_COUNT, | |
2784 txtPointl); | |
2785 WinReleasePS(hpsTemp); | |
2786 | |
2787 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
2788 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
2789 | |
2790 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
2791 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
2792 | |
2793 ptlWork.y -= lHight; | |
2794 | |
2795 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
2796 | |
2797 if(blah) | |
2798 WinSetWindowPtr(hwndBubble, QWP_USER, blah); | |
2799 | |
2800 WinSetWindowPos(hwndBubble, | |
2801 HWND_TOP, | |
2802 ptlWork.x, | |
2803 ptlWork.y, | |
2804 lWidth, | |
2805 lHight, | |
2806 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
2807 } | |
2808 break; | |
2809 } | |
2810 | |
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
|
2811 if(!oldproc) |
3 | 2812 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
|
2813 return oldproc(hwnd, msg, mp1, mp2); |
3 | 2814 } |
2815 | |
2816 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2817 { | |
2818 int res = 0; | |
2819 #ifndef NO_SIGNALS | |
2820 res = (int)_run_event(hwnd, msg, mp1, mp2); | |
2821 #endif | |
2822 switch(msg) | |
2823 { | |
2824 case WM_BUTTON1DOWN: | |
2825 case WM_BUTTON2DOWN: | |
2826 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
|
2827 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
|
2828 return (MPARAM)TRUE; |
3 | 2829 } |
2830 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2831 } | |
2832 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2833 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
|
2834 { |
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
|
2835 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
|
2836 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
|
2837 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2838 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
|
2839 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
|
2840 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2841 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
|
2842 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2843 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
|
2844 _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
|
2845 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
|
2846 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
|
2847 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
|
2848 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2849 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
|
2850 _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
|
2851 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
|
2852 _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
|
2853 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
|
2854 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
2855 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
|
2856 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2857 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2858 #ifndef NO_SIGNALS |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2859 _run_event(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2860 #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
|
2861 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
|
2862 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
|
2863 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2864 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2865 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2866 |
3 | 2867 /* |
2868 * Initializes the Dynamic Windows engine. | |
2869 * Parameters: | |
2870 * newthread: True if this is the only thread. | |
2871 * False if there is already a message loop running. | |
2872 */ | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2873 int dw_init(int newthread, int argc, char *argv[]) |
3 | 2874 { |
2875 APIRET rc; | |
2876 | |
2877 if(newthread) | |
2878 { | |
2879 dwhab = WinInitialize(0); | |
2880 dwhmq = WinCreateMsgQueue(dwhab, 0); | |
2881 } | |
2882 | |
2883 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | |
2884 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); | |
2885 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2886 /* Get the OS/2 version. */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2887 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
|
2888 |
3 | 2889 #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
|
2890 f = fopen("dw.log", "w"); |
3 | 2891 #endif |
2892 return rc; | |
2893 } | |
2894 | |
2895 /* | |
2896 * Runs a message loop for Dynamic Windows. | |
2897 * Parameters: | |
2898 * currenthab: The handle to the current anchor block | |
2899 * or NULL if this DW is handling the message loop. | |
2900 * func: Function pointer to the message filter function. | |
2901 */ | |
2902 void dw_main(HAB currenthab, void *func) | |
2903 { | |
2904 QMSG qmsg; | |
2905 HAB habtouse; | |
2906 | |
2907 if(!currenthab) | |
2908 habtouse = dwhab; | |
2909 else | |
2910 habtouse = currenthab; | |
2911 | |
2912 /* Setup the filter function */ | |
2913 filterfunc = (int (* EXPENTRY)(HWND, ULONG, MPARAM, MPARAM))func; | |
2914 | |
2915 _dwtid = dw_thread_id(); | |
2916 | |
2917 while (WinGetMsg(habtouse, &qmsg, 0, 0, 0)) | |
2918 WinDispatchMsg(habtouse, &qmsg); | |
2919 | |
2920 #ifdef DWDEBUG | |
2921 fclose(f); | |
2922 #endif | |
2923 | |
2924 if(!currenthab) | |
2925 { | |
2926 WinDestroyMsgQueue(dwhmq); | |
2927 WinTerminate(dwhab); | |
2928 } | |
2929 } | |
2930 | |
2931 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2932 * 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
|
2933 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2934 * 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
|
2935 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2936 void dw_main_sleep(int milliseconds) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2937 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2938 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
|
2939 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
|
2940 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2941 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
|
2942 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2943 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
|
2944 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2945 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2946 WinDispatchMsg(dwhab, &qmsg); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2947 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2948 else |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2949 DosSleep(1); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2950 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2951 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2952 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2953 /* |
3 | 2954 * Free's memory allocated by dynamic windows. |
2955 * Parameters: | |
2956 * ptr: Pointer to dynamic windows allocated | |
2957 * memory to be free()'d. | |
2958 */ | |
2959 void dw_free(void *ptr) | |
2960 { | |
2961 free(ptr); | |
2962 } | |
2963 | |
2964 /* | |
2965 * Allocates and initializes a dialog struct. | |
2966 * Parameters: | |
2967 * data: User defined data to be passed to functions. | |
2968 */ | |
2969 DWDialog *dw_dialog_new(void *data) | |
2970 { | |
2971 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
2972 | |
2973 tmp->eve = dw_event_new(); | |
2974 dw_event_reset(tmp->eve); | |
2975 tmp->data = data; | |
2976 tmp->done = FALSE; | |
2977 tmp->result = NULL; | |
2978 | |
2979 return tmp; | |
2980 } | |
2981 | |
2982 /* | |
2983 * Accepts a dialog struct and returns the given data to the | |
2984 * initial called of dw_dialog_wait(). | |
2985 * Parameters: | |
2986 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
2987 * result: Data to be returned by dw_dialog_wait(). | |
2988 */ | |
2989 int dw_dialog_dismiss(DWDialog *dialog, void *result) | |
2990 { | |
2991 dialog->result = result; | |
2992 dw_event_post(dialog->eve); | |
2993 dialog->done = TRUE; | |
2994 return 0; | |
2995 } | |
2996 | |
2997 /* | |
2998 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
2999 * called by a signal handler with the given dialog struct. | |
3000 * Parameters: | |
3001 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3002 */ | |
3003 void *dw_dialog_wait(DWDialog *dialog) | |
3004 { | |
3005 QMSG qmsg; | |
3006 void *tmp; | |
3007 | |
3008 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | |
3009 { | |
3010 WinDispatchMsg(dwhab, &qmsg); | |
3011 if(dialog->done) | |
3012 break; | |
3013 } | |
3014 dw_event_close(&dialog->eve); | |
3015 tmp = dialog->result; | |
3016 free(dialog); | |
3017 return tmp; | |
3018 } | |
3019 | |
3020 | |
3021 /* | |
3022 * Displays a Message Box with given text and title.. | |
3023 * Parameters: | |
3024 * title: The title of the message box. | |
3025 * format: printf style format string. | |
3026 * ...: Additional variables for use in the format. | |
3027 */ | |
3028 int dw_messagebox(char *title, char *format, ...) | |
3029 { | |
3030 va_list args; | |
3031 char outbuf[1024]; | |
3032 | |
3033 va_start(args, format); | |
3034 vsprintf(outbuf, format, args); | |
3035 va_end(args); | |
3036 | |
3037 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE); | |
3038 | |
3039 return strlen(outbuf); | |
3040 } | |
3041 | |
3042 /* | |
3043 * Displays a Message Box with given text and title.. | |
3044 * Parameters: | |
3045 * title: The title of the message box. | |
3046 * text: The text to display in the box. | |
3047 * Returns: | |
3048 * True if YES False of NO. | |
3049 */ | |
3050 int dw_yesno(char *title, char *text) | |
3051 { | |
3052 if(WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, title, 0, MB_YESNO | MB_INFORMATION | MB_MOVEABLE | MB_SYSTEMMODAL)==MBID_YES) | |
3053 return TRUE; | |
3054 return FALSE; | |
3055 } | |
3056 | |
3057 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3058 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3059 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3060 * 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
|
3061 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3062 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
|
3063 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3064 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
|
3065 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3066 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3067 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3068 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3069 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3070 * 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
|
3071 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3072 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
|
3073 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3074 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
|
3075 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3076 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3077 /* |
3 | 3078 * Makes the window visible. |
3079 * Parameters: | |
3080 * handle: The window handle to make visible. | |
3081 */ | |
3082 int dw_window_show(HWND handle) | |
3083 { | |
3084 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW); | |
3085 HSWITCH hswitch; | |
3086 SWCNTRL swcntrl; | |
3087 | |
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
|
3088 _fix_button_owner(_toplevel_window(handle), 0); |
3 | 3089 WinSetFocus(HWND_DESKTOP, handle); |
3090 _initial_focus(handle); | |
3091 | |
3092 /* If this window has a switch list entry make sure it is visible */ | |
3093 hswitch = WinQuerySwitchHandle(handle, 0); | |
3094 if(hswitch) | |
3095 { | |
3096 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3097 swcntrl.uchVisibility = SWL_VISIBLE; | |
3098 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3099 } | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3100 if(WinWindowFromID(handle, FID_CLIENT)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3101 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3102 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3103 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3104 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
|
3105 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3106 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
|
3107 int newx, newy, changed = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3108 SWP swp; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3109 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3110 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3111 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3112 WinQueryWindowPos(handle, &swp); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3113 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3114 newx = swp.x; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3115 newy = swp.y; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3116 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3117 if((swp.x+swp.cx) > cx) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3118 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3119 newx = (cx - swp.cx)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3120 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3121 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3122 if((swp.y+swp.cy) > cy) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3123 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3124 newy = (cy - swp.cy)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3125 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3126 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3127 if(changed) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3128 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
|
3129 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3130 } |
3 | 3131 return rc; |
3132 } | |
3133 | |
3134 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3135 * 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
|
3136 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3137 * handle: The window handle to minimize. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3138 */ |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3139 int dw_window_minimize(HWND handle) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3140 { |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3141 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
|
3142 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3143 if(hwndclient) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3144 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3145 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
|
3146 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3147 if(box) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3148 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3149 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
|
3150 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
|
3151 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3152 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3153 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3154 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
|
3155 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3156 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3157 /* |
3 | 3158 * Makes the window invisible. |
3159 * Parameters: | |
3160 * handle: The window handle to make visible. | |
3161 */ | |
3162 int dw_window_hide(HWND handle) | |
3163 { | |
3164 HSWITCH hswitch; | |
3165 SWCNTRL swcntrl; | |
3166 | |
3167 /* If this window has a switch list entry make sure it is invisible */ | |
3168 hswitch = WinQuerySwitchHandle(handle, 0); | |
3169 if(hswitch) | |
3170 { | |
3171 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3172 swcntrl.uchVisibility = SWL_INVISIBLE; | |
3173 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3174 } | |
3175 return WinShowWindow(handle, FALSE); | |
3176 } | |
3177 | |
3178 /* | |
3179 * Destroys a window and all of it's children. | |
3180 * Parameters: | |
3181 * handle: The window handle to destroy. | |
3182 */ | |
3183 int dw_window_destroy(HWND handle) | |
3184 { | |
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
|
3185 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
|
3186 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
|
3187 |
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
|
3188 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
|
3189 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
|
3190 |
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
|
3191 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
|
3192 { |
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
|
3193 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
|
3194 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
|
3195 |
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
|
3196 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
|
3197 { |
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
|
3198 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
|
3199 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
|
3200 } |
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
|
3201 |
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
|
3202 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
|
3203 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
|
3204 |
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
|
3205 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
|
3206 |
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
|
3207 /* 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
|
3208 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
|
3209 { |
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
|
3210 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
|
3211 } |
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
|
3212 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
|
3213 { |
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
|
3214 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
|
3215 } |
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
|
3216 |
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
|
3217 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
|
3218 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
|
3219 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
|
3220 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3221 _disconnect_windows(handle); |
3 | 3222 return WinDestroyWindow(handle); |
3223 } | |
3224 | |
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
|
3225 /* 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
|
3226 * 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
|
3227 * 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
|
3228 */ |
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
|
3229 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
|
3230 { |
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
|
3231 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
|
3232 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
|
3233 |
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
|
3234 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
|
3235 { |
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
|
3236 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
|
3237 |
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
|
3238 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
|
3239 |
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
|
3240 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
|
3241 _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
|
3242 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
|
3243 } |
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
|
3244 } |
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
|
3245 |
3 | 3246 /* |
3247 * Changes a window's parent to newparent. | |
3248 * Parameters: | |
3249 * handle: The window handle to destroy. | |
3250 * newparent: The window's new parent window. | |
3251 */ | |
3252 void dw_window_reparent(HWND handle, HWND newparent) | |
3253 { | |
3254 HWND blah = WinWindowFromID(newparent, FID_CLIENT); | |
3255 WinSetParent(handle, blah ? blah : newparent, TRUE); | |
3256 } | |
3257 | |
3258 /* | |
3259 * Sets the font used by a specified window (widget) handle. | |
3260 * Parameters: | |
3261 * handle: The window (widget) handle. | |
3262 * fontname: Name and size of the font in the form "size.fontname" | |
3263 */ | |
3264 int dw_window_set_font(HWND handle, char *fontname) | |
3265 { | |
3266 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | |
3267 } | |
3268 | |
3269 /* | |
3270 * Sets the colors used by a specified window (widget) handle. | |
3271 * Parameters: | |
3272 * handle: The window (widget) handle. | |
3273 * fore: Foreground color in DW_RGB format or a default color index. | |
3274 * back: Background color in DW_RGB format or a default color index. | |
3275 */ | |
3276 int dw_window_set_color(HWND handle, ULONG fore, ULONG back) | |
3277 { | |
3278 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3279 { | |
3280 RGB2 rgb2; | |
3281 | |
3282 rgb2.bBlue = DW_BLUE_VALUE(fore); | |
3283 rgb2.bGreen = DW_GREEN_VALUE(fore); | |
3284 rgb2.bRed = DW_RED_VALUE(fore); | |
3285 rgb2.fcOptions = 0; | |
3286 | |
3287 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3288 | |
3289 } | |
3290 if((back & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3291 { | |
3292 RGB2 rgb2; | |
3293 | |
3294 rgb2.bBlue = DW_BLUE_VALUE(back); | |
3295 rgb2.bGreen = DW_GREEN_VALUE(back); | |
3296 rgb2.bRed = DW_RED_VALUE(back); | |
3297 rgb2.fcOptions = 0; | |
3298 | |
3299 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3300 return 0; | |
3301 } | |
3302 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3303 return 0; | |
3304 | |
3305 /* Slight conversion */ | |
3306 if(fore == DW_CLR_BLACK) | |
3307 fore = CLR_BLACK; | |
3308 if(fore == DW_CLR_WHITE) | |
3309 fore = CLR_WHITE; | |
3310 | |
3311 if(back == DW_CLR_BLACK) | |
3312 back = CLR_BLACK; | |
3313 if(back == DW_CLR_WHITE) | |
3314 back = CLR_WHITE; | |
3315 | |
3316 return (WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore) | | |
3317 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back)); | |
3318 } | |
3319 | |
3320 /* | |
3321 * Sets the font used by a specified window (widget) handle. | |
3322 * Parameters: | |
3323 * handle: The window (widget) handle. | |
3324 * border: Size of the window border in pixels. | |
3325 */ | |
3326 int dw_window_set_border(HWND handle, int border) | |
3327 { | |
3328 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border)); | |
3329 return 0; | |
3330 } | |
3331 | |
3332 /* | |
3333 * Captures the mouse input to this window. | |
3334 * Parameters: | |
3335 * handle: Handle to receive mouse input. | |
3336 */ | |
3337 void dw_window_capture(HWND handle) | |
3338 { | |
3339 WinSetCapture(HWND_DESKTOP, handle); | |
3340 } | |
3341 | |
3342 /* | |
3343 * Releases previous mouse capture. | |
3344 */ | |
3345 void dw_window_release(void) | |
3346 { | |
3347 WinSetCapture(HWND_DESKTOP, NULLHANDLE); | |
3348 } | |
3349 | |
3350 /* | |
3351 * Tracks this window movement. | |
3352 * Parameters: | |
3353 * handle: Handle to frame to be tracked. | |
3354 */ | |
3355 void dw_window_track(HWND handle) | |
3356 { | |
3357 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0); | |
3358 } | |
3359 | |
3360 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3361 * 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
|
3362 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3363 * 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
|
3364 * 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
|
3365 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3366 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
|
3367 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3368 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
|
3369 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
|
3370 pointertype, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3371 FALSE)); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3372 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3373 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3374 /* |
3 | 3375 * Create a new Window Frame. |
3376 * Parameters: | |
3377 * owner: The Owner's window handle or HWND_DESKTOP. | |
3378 * title: The Window title. | |
3379 * flStyle: Style flags, see the PM reference. | |
3380 */ | |
3381 HWND dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) | |
3382 { | |
3383 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
|
3384 Box *newbox = calloc(1, sizeof(Box)); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3385 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3386 |
3387 newbox->pad = 0; | |
3388 newbox->type = BOXVERT; | |
3389 newbox->count = 0; | |
3390 | |
3391 flStyle |= FCF_NOBYTEALIGN; | |
3392 | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3393 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
|
3394 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
|
3395 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3396 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
|
3397 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3398 if(!(flStyle & FCF_SHELLPOSITION)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3399 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3400 |
3 | 3401 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
|
3402 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
|
3403 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
|
3404 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3405 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); |
3 | 3406 WinSetWindowPtr(hwndframe, QWP_USER, blah); |
3407 WinSetWindowPtr(hwndclient, QWP_USER, newbox); | |
3408 | |
3409 return hwndframe; | |
3410 } | |
3411 | |
3412 /* | |
3413 * Create a new Box to be packed. | |
3414 * Parameters: | |
3415 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | |
3416 * pad: Number of pixels to pad around the box. | |
3417 */ | |
3418 HWND dw_box_new(int type, int pad) | |
3419 { | |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3420 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3421 HWND hwndframe; |
3422 | |
3423 newbox->pad = pad; | |
3424 newbox->type = type; | |
3425 newbox->count = 0; | |
3426 newbox->grouphwnd = NULLHANDLE; | |
3427 | |
3428 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3429 WC_FRAME, | |
3430 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
|
3431 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
|
3432 FS_NOBYTEALIGN, |
3 | 3433 0,0,2000,1000, |
3434 NULLHANDLE, | |
3435 HWND_TOP, | |
3436 0L, | |
3437 NULL, | |
3438 NULL); | |
3439 | |
3440 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc); | |
3441 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3442 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3443 return hwndframe; | |
3444 } | |
3445 | |
3446 /* | |
3447 * Create a new Group Box to be packed. | |
3448 * Parameters: | |
3449 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | |
3450 * pad: Number of pixels to pad around the box. | |
3451 * title: Text to be displayined in the group outline. | |
3452 */ | |
3453 HWND dw_groupbox_new(int type, int pad, char *title) | |
3454 { | |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3455 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3456 HWND hwndframe; |
3457 | |
3458 newbox->pad = pad; | |
3459 newbox->type = type; | |
3460 newbox->count = 0; | |
3461 | |
3462 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3463 WC_FRAME, | |
3464 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
|
3465 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
|
3466 FS_NOBYTEALIGN, |
3 | 3467 0,0,2000,1000, |
3468 NULLHANDLE, | |
3469 HWND_TOP, | |
3470 0L, | |
3471 NULL, | |
3472 NULL); | |
3473 | |
3474 newbox->grouphwnd = WinCreateWindow(hwndframe, | |
3475 WC_STATIC, | |
3476 title, | |
3477 WS_VISIBLE | SS_GROUPBOX | | |
3478 WS_GROUP, | |
3479 0,0,2000,1000, | |
3480 NULLHANDLE, | |
3481 HWND_TOP, | |
3482 0L, | |
3483 NULL, | |
3484 NULL); | |
3485 | |
3486 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3487 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3488 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
3489 dw_window_set_font(newbox->grouphwnd, DefaultFont); | |
3490 return hwndframe; | |
3491 } | |
3492 | |
3493 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3494 * 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
|
3495 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3496 * 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
|
3497 */ |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3498 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
|
3499 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3500 HWND hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3501 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3502 hwndframe = WinCreateWindow(HWND_OBJECT, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3503 WC_FRAME, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3504 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
|
3505 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
|
3506 FS_NOBYTEALIGN, |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3507 0,0,2000,1000, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3508 NULLHANDLE, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3509 HWND_TOP, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3510 0L, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3511 NULL, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3512 NULL); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3513 return hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3514 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3515 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3516 /* |
3 | 3517 * Create a bitmap object to be packed. |
3518 * Parameters: | |
3519 * id: An ID to be used with WinWindowFromID() or 0L. | |
3520 */ | |
3521 HWND dw_bitmap_new(ULONG id) | |
3522 { | |
3523 return WinCreateWindow(HWND_OBJECT, | |
3524 WC_STATIC, | |
3525 NULL, | |
3526 WS_VISIBLE | SS_TEXT, | |
3527 0,0,2000,1000, | |
3528 NULLHANDLE, | |
3529 HWND_TOP, | |
3530 id, | |
3531 NULL, | |
3532 NULL); | |
3533 } | |
3534 | |
3535 /* | |
3536 * Create a notebook object to be packed. | |
3537 * Parameters: | |
3538 * id: An ID to be used for getting the resource from the | |
3539 * resource file. | |
3540 */ | |
3541 HWND dw_notebook_new(ULONG id, int top) | |
3542 { | |
3543 ULONG flags; | |
3544 HWND tmp; | |
3545 | |
3546 if(top) | |
3547 flags = BKS_MAJORTABTOP; | |
3548 else | |
3549 flags = BKS_MAJORTABBOTTOM; | |
3550 | |
3551 tmp = WinCreateWindow(HWND_OBJECT, | |
3552 WC_NOTEBOOK, | |
3553 NULL, | |
3554 WS_VISIBLE | | |
3555 BKS_TABBEDDIALOG | | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3556 flags, |
3 | 3557 0,0,2000,1000, |
3558 NULLHANDLE, | |
3559 HWND_TOP, | |
3560 id, | |
3561 NULL, | |
3562 NULL); | |
3563 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3564 /* Fix tab sizes on Warp 3 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3565 if(!IS_WARP4()) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3566 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3567 /* 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
|
3568 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
|
3569 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3570 |
3 | 3571 dw_window_set_font(tmp, DefaultFont); |
3572 return tmp; | |
3573 } | |
3574 | |
3575 /* | |
3576 * Create a menu object to be popped up. | |
3577 * Parameters: | |
3578 * id: An ID to be used for getting the resource from the | |
3579 * resource file. | |
3580 */ | |
3581 HMENUI dw_menu_new(ULONG id) | |
3582 { | |
3583 HMENUI tmp = malloc(sizeof(struct _hmenui)); | |
3584 | |
3585 if(!tmp) | |
3586 return NULL; | |
3587 | |
3588 tmp->menu = WinCreateWindow(HWND_OBJECT, | |
3589 WC_MENU, | |
3590 NULL, | |
3591 WS_VISIBLE, | |
3592 0,0,2000,1000, | |
3593 NULLHANDLE, | |
3594 HWND_TOP, | |
3595 id, | |
3596 NULL, | |
3597 NULL); | |
3598 return tmp; | |
3599 } | |
3600 | |
3601 /* | |
3602 * Create a menubar on a window. | |
3603 * Parameters: | |
3604 * location: Handle of a window frame to be attached to. | |
3605 */ | |
3606 HMENUI dw_menubar_new(HWND location) | |
3607 { | |
3608 HMENUI tmp = malloc(sizeof(struct _hmenui)); | |
3609 | |
3610 if(!tmp) | |
3611 return NULL; | |
3612 | |
3613 tmp->menu = WinCreateWindow(location, | |
3614 WC_MENU, | |
3615 NULL, | |
3616 WS_VISIBLE | MS_ACTIONBAR, | |
3617 0,0,2000,1000, | |
3618 location, | |
3619 HWND_TOP, | |
3620 FID_MENU, | |
3621 NULL, | |
3622 NULL); | |
3623 return tmp; | |
3624 } | |
3625 | |
3626 /* | |
3627 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
3628 * Parameters: | |
3629 * menu: Handle of a menu. | |
3630 */ | |
3631 void dw_menu_destroy(HMENUI *menu) | |
3632 { | |
3633 if(menu && *menu) | |
3634 { | |
3635 WinDestroyWindow((*menu)->menu); | |
3636 free(*menu); | |
3637 *menu = NULL; | |
3638 } | |
3639 } | |
3640 | |
3641 /* | |
3642 * Adds a menuitem or submenu to an existing menu. | |
3643 * Parameters: | |
3644 * menu: The handle the the existing menu. | |
3645 * title: The title text on the menu item to be added. | |
3646 * id: An ID to be used for message passing. | |
3647 * flags: Extended attributes to set on the menu. | |
3648 * end: If TRUE memu is positioned at the end of the menu. | |
3649 * check: If TRUE menu is "check"able. | |
3650 * submenu: Handle to an existing menu to be a submenu or NULL. | |
3651 */ | |
3652 HWND dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) | |
3653 { | |
3654 MENUITEM miSubMenu; | |
3655 HWND menu; | |
3656 | |
3657 if(!menux) | |
3658 return NULLHANDLE; | |
3659 | |
3660 menu = menux->menu; | |
3661 | |
3662 if(end) | |
3663 miSubMenu.iPosition=MIT_END; | |
3664 else | |
3665 miSubMenu.iPosition=0; | |
3666 | |
3667 if(strlen(title) == 0) | |
3668 miSubMenu.afStyle=MIS_SEPARATOR | flags; | |
3669 else | |
3670 miSubMenu.afStyle=MIS_TEXT | flags; | |
3671 miSubMenu.afAttribute=0; | |
3672 miSubMenu.id=id; | |
3673 miSubMenu.hwndSubMenu = submenu ? submenu->menu : 0; | |
3674 miSubMenu.hItem=NULLHANDLE; | |
3675 | |
3676 WinSendMsg(menu, | |
3677 MM_INSERTITEM, | |
3678 MPFROMP(&miSubMenu), | |
3679 MPFROMP(title)); | |
3680 return (HWND)id; | |
3681 } | |
3682 | |
3683 /* | |
3684 * Sets the state of a menu item check. | |
3685 * Parameters: | |
3686 * menu: The handle the the existing menu. | |
3687 * id: Menuitem id. | |
3688 * check: TRUE for checked FALSE for not checked. | |
3689 */ | |
12
26e2130135b9
Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
9
diff
changeset
|
3690 void dw_menu_item_set_check(HMENUI menux, unsigned long id, int check) |
3 | 3691 { |
3692 HWND menu; | |
3693 | |
3694 if(!menux) | |
3695 return; | |
3696 | |
3697 menu = menux->menu; | |
3698 | |
3699 if(check) | |
3700 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), | |
3701 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)); | |
3702 else | |
3703 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), | |
3704 MPFROM2SHORT(MIA_CHECKED, 0)); | |
3705 } | |
3706 | |
3707 /* | |
3708 * Pops up a context menu at given x and y coordinates. | |
3709 * Parameters: | |
3710 * menu: The handle the the existing menu. | |
3711 * parent: Handle to the window initiating the popup. | |
3712 * x: X coordinate. | |
3713 * y: Y coordinate. | |
3714 */ | |
3715 void dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) | |
3716 { | |
3717 if(menu && *menu) | |
3718 { | |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
3719 popup = parent; |
3 | 3720 WinPopupMenu(HWND_DESKTOP, parent, (*menu)->menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN); |
3721 free(*menu); | |
3722 *menu = NULL; | |
3723 } | |
3724 } | |
3725 | |
3726 /* | |
3727 * Returns the current X and Y coordinates of the mouse pointer. | |
3728 * Parameters: | |
3729 * x: Pointer to variable to store X coordinate. | |
3730 * y: Pointer to variable to store Y coordinate. | |
3731 */ | |
3732 void dw_pointer_query_pos(long *x, long *y) | |
3733 { | |
3734 POINTL ptl; | |
3735 | |
3736 WinQueryPointerPos(HWND_DESKTOP, &ptl); | |
3737 if(x && y) | |
3738 { | |
3739 *x = ptl.x; | |
3740 *y = dw_screen_height() - ptl.y; | |
3741 } | |
3742 } | |
3743 | |
3744 /* | |
3745 * Sets the X and Y coordinates of the mouse pointer. | |
3746 * Parameters: | |
3747 * x: X coordinate. | |
3748 * y: Y coordinate. | |
3749 */ | |
3750 void dw_pointer_set_pos(long x, long y) | |
3751 { | |
3752 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y); | |
3753 } | |
3754 | |
3755 /* | |
3756 * Create a container object to be packed. | |
3757 * Parameters: | |
3758 * id: An ID to be used for getting the resource from the | |
3759 * resource file. | |
3760 */ | |
3761 HWND dw_container_new(ULONG id) | |
3762 { | |
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
|
3763 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3764 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3765 WC_CONTAINER, | |
3766 NULL, | |
3767 WS_VISIBLE | CCS_READONLY | | |
3768 CCS_SINGLESEL | CCS_AUTOPOSITION, | |
3769 0,0,2000,1000, | |
3770 NULLHANDLE, | |
3771 HWND_TOP, | |
3772 id, | |
3773 NULL, | |
3774 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
|
3775 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
|
3776 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 3777 dw_window_set_font(tmp, DefaultFont); |
3778 return tmp; | |
3779 } | |
3780 | |
3781 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3782 * 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
|
3783 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3784 * 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
|
3785 * 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
|
3786 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3787 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
|
3788 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3789 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
|
3790 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
|
3791 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
|
3792 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
|
3793 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3794 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
|
3795 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
|
3796 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
|
3797 NULLHANDLE, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3798 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
|
3799 id, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3800 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3801 NULL); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3802 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3803 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
|
3804 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
|
3805 cnrinfo.slBitmapOrIcon.cy = 16; |
108
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
3806 cnrinfo.cyLineSpacing = 0; |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
3807 cnrinfo.cxTreeIndent = 16; |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
3808 cnrinfo.cxTreeLine = 1; |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
3809 |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
3810 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON | |
108674099806
Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
103
diff
changeset
|
3811 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE)); |
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
|
3812 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
|
3813 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
|
3814 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
|
3815 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
|
3816 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3817 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3818 /* |
3 | 3819 * Create a new static text window (widget) to be packed. |
3820 * Parameters: | |
3821 * text: The text to be display by the static text widget. | |
3822 * id: An ID to be used with WinWindowFromID() or 0L. | |
3823 */ | |
3824 HWND dw_text_new(char *text, ULONG id) | |
3825 { | |
3826 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
3827 WC_STATIC, | |
3828 text, | |
3829 WS_VISIBLE | SS_TEXT, | |
3830 0,0,2000,1000, | |
3831 NULLHANDLE, | |
3832 HWND_TOP, | |
3833 id, | |
3834 NULL, | |
3835 NULL); | |
3836 dw_window_set_font(tmp, DefaultFont); | |
3837 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
3838 return tmp; | |
3839 } | |
3840 | |
3841 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3842 * 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
|
3843 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3844 * 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
|
3845 * 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
|
3846 */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3847 HWND dw_status_text_new(char *text, ULONG id) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3848 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3849 WindowData *blah = calloc(sizeof(WindowData), 1); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3850 HWND tmp = WinCreateWindow(HWND_OBJECT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3851 WC_STATIC, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3852 text, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3853 WS_VISIBLE | SS_TEXT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3854 0,0,2000,1000, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3855 NULLHANDLE, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3856 HWND_TOP, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3857 id, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3858 NULL, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3859 NULL); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3860 dw_window_set_font(tmp, DefaultFont); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3861 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
|
3862 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3863 blah->oldproc = WinSubclassWindow(tmp, _statusproc); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3864 WinSetWindowPtr(tmp, QWP_USER, blah); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3865 return tmp; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3866 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3867 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3868 /* |
3 | 3869 * Create a new Multiline Editbox window (widget) to be packed. |
3870 * Parameters: | |
3871 * id: An ID to be used with WinWindowFromID() or 0L. | |
3872 */ | |
3873 HWND dw_mle_new(ULONG id) | |
3874 { | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3875 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3876 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3877 WC_MLE, | |
3878 "", | |
3879 WS_VISIBLE | | |
3880 MLS_BORDER | MLS_IGNORETAB | | |
3881 MLS_READONLY | MLS_VSCROLL, | |
3882 0,0,2000,1000, | |
3883 NULLHANDLE, | |
3884 HWND_TOP, | |
3885 id, | |
3886 NULL, | |
3887 NULL); | |
3888 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
|
3889 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3890 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 3891 return tmp; |
3892 } | |
3893 | |
3894 /* | |
3895 * Create a new Entryfield window (widget) to be packed. | |
3896 * Parameters: | |
3897 * text: The default text to be in the entryfield widget. | |
3898 * id: An ID to be used with WinWindowFromID() or 0L. | |
3899 */ | |
3900 HWND dw_entryfield_new(char *text, ULONG id) | |
3901 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3902 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3903 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3904 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3905 WC_ENTRYFIELD, | |
3906 text, | |
3907 WS_VISIBLE | ES_MARGIN | | |
3908 ES_AUTOSCROLL | WS_TABSTOP, | |
3909 0,0,2000,1000, | |
3910 NULLHANDLE, | |
3911 HWND_TOP, | |
3912 id, | |
3913 NULL, | |
3914 NULL); | |
3915 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
|
3916 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 3917 WinSetWindowPtr(tmp, QWP_USER, blah); |
3918 return tmp; | |
3919 } | |
3920 | |
3921 /* | |
3922 * Create a new Entryfield (password) window (widget) to be packed. | |
3923 * Parameters: | |
3924 * text: The default text to be in the entryfield widget. | |
3925 * id: An ID to be used with WinWindowFromID() or 0L. | |
3926 */ | |
3927 HWND dw_entryfield_password_new(char *text, ULONG id) | |
3928 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3929 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3930 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3931 WC_ENTRYFIELD, | |
3932 text, | |
3933 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE | | |
3934 ES_AUTOSCROLL | WS_TABSTOP, | |
3935 0,0,2000,1000, | |
3936 NULLHANDLE, | |
3937 HWND_TOP, | |
3938 id, | |
3939 NULL, | |
3940 NULL); | |
3941 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
|
3942 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 3943 WinSetWindowPtr(tmp, QWP_USER, blah); |
3944 return tmp; | |
3945 } | |
3946 | |
3947 /* | |
3948 * Create a new Combobox window (widget) to be packed. | |
3949 * Parameters: | |
3950 * text: The default text to be in the combpbox widget. | |
3951 * id: An ID to be used with WinWindowFromID() or 0L. | |
3952 */ | |
3953 HWND dw_combobox_new(char *text, ULONG id) | |
3954 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3955 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3956 HWND tmp = WinCreateWindow(HWND_OBJECT, |
3957 WC_COMBOBOX, | |
3958 text, | |
3959 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, | |
3960 0,0,2000,1000, | |
3961 NULLHANDLE, | |
3962 HWND_TOP, | |
3963 id, | |
3964 NULL, | |
3965 NULL); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3966 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
|
3967 HWND child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3968 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3969 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
|
3970 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3971 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
|
3972 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
|
3973 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
|
3974 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
3975 WinEndEnumWindows(henum); |
3 | 3976 dw_window_set_font(tmp, DefaultFont); |
3977 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
|
3978 blah->oldproc = WinSubclassWindow(tmp, _comboproc); |
3 | 3979 WinSetWindowPtr(tmp, QWP_USER, blah); |
3980 return tmp; | |
3981 } | |
3982 | |
3983 /* | |
3984 * Create a new button window (widget) to be packed. | |
3985 * Parameters: | |
3986 * text: The text to be display by the static text widget. | |
3987 * id: An ID to be used with WinWindowFromID() or 0L. | |
3988 */ | |
3989 HWND dw_button_new(char *text, ULONG id) | |
3990 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
3991 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 3992 |
3993 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
3994 WC_BUTTON, | |
3995 text, | |
3996 WS_VISIBLE, | |
3997 0,0,2000,1000, | |
3998 NULLHANDLE, | |
3999 HWND_TOP, | |
4000 id, | |
4001 NULL, | |
4002 NULL); | |
4003 | |
4004 bubble->id = id; | |
4005 bubble->bubbletext[0] = '\0'; | |
4006 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4007 | |
4008 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
4009 dw_window_set_font(tmp, DefaultFont); | |
4010 return tmp; | |
4011 } | |
4012 | |
4013 /* Function: GenResIDStr | |
4014 ** Abstract: Generate string '#nnnn' for a given ID for using with Button | |
4015 ** controls | |
4016 */ | |
4017 | |
4018 void _GenResIDStr(CHAR *buff, ULONG ulID) | |
4019 { | |
4020 char *str; | |
4021 int slen = 0; | |
4022 | |
4023 *buff++ = '#'; | |
4024 | |
4025 str = buff; | |
4026 | |
4027 do | |
4028 { | |
4029 *str++ = (ulID % 10) + '0'; | |
4030 ulID /= 10; | |
4031 slen++; | |
4032 } | |
4033 while(ulID); | |
4034 | |
4035 *str-- = 0; | |
4036 | |
4037 for(; str > buff; str--, buff++) | |
4038 { | |
4039 *buff ^= *str; | |
4040 *str ^= *buff; | |
4041 *buff ^= *str; | |
4042 } | |
4043 } | |
4044 | |
4045 | |
4046 /* | |
4047 * Create a new bitmap button window (widget) to be packed. | |
4048 * Parameters: | |
4049 * text: Bubble help text to be displayed. | |
4050 * id: An ID of a bitmap in the resource file. | |
4051 */ | |
4052 HWND dw_bitmapbutton_new(char *text, ULONG id) | |
4053 { | |
4054 char idbuf[256]; | |
4055 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
|
4056 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4057 |
4058 _GenResIDStr(idbuf, id); | |
4059 | |
4060 tmp = WinCreateWindow(HWND_OBJECT, | |
4061 WC_BUTTON, | |
4062 idbuf, | |
4063 WS_VISIBLE | BS_PUSHBUTTON | | |
4064 BS_BITMAP | BS_AUTOSIZE | | |
4065 BS_NOPOINTERFOCUS, | |
4066 0,0,2000,1000, | |
4067 NULLHANDLE, | |
4068 HWND_TOP, | |
4069 id, | |
4070 NULL, | |
4071 NULL); | |
4072 | |
4073 bubble->id = id; | |
4074 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | |
4075 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
4076 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4077 | |
4078 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
4079 return tmp; | |
4080 } | |
4081 | |
4082 /* | |
4083 * Create a new spinbutton window (widget) to be packed. | |
4084 * Parameters: | |
4085 * text: The text to be display by the static text widget. | |
4086 * id: An ID to be used with WinWindowFromID() or 0L. | |
4087 */ | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4088 HWND dw_spinbutton_new(char *text, ULONG id) |
3 | 4089 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4090 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4091 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4092 WC_SPINBUTTON, | |
4093 text, | |
4094 WS_VISIBLE | SPBS_MASTER, | |
4095 0,0,2000,1000, | |
4096 NULLHANDLE, | |
4097 HWND_TOP, | |
4098 id, | |
4099 NULL, | |
4100 NULL); | |
4101 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
|
4102 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4103 WinSetWindowPtr(tmp, QWP_USER, blah); |
4104 return tmp; | |
4105 } | |
4106 | |
4107 /* | |
4108 * Create a new radiobutton window (widget) to be packed. | |
4109 * Parameters: | |
4110 * text: The text to be display by the static text widget. | |
4111 * id: An ID to be used with WinWindowFromID() or 0L. | |
4112 */ | |
4113 HWND dw_radiobutton_new(char *text, ULONG id) | |
4114 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4115 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4116 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4117 WC_BUTTON, | |
4118 text, | |
4119 WS_VISIBLE | | |
4120 BS_AUTORADIOBUTTON, | |
4121 0,0,2000,1000, | |
4122 NULLHANDLE, | |
4123 HWND_TOP, | |
4124 id, | |
4125 NULL, | |
4126 NULL); | |
4127 dw_window_set_font(tmp, DefaultFont); | |
4128 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
|
4129 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4130 WinSetWindowPtr(tmp, QWP_USER, blah); |
4131 return tmp; | |
4132 } | |
4133 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4134 |
3 | 4135 /* |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4136 * 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
|
4137 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4138 * 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
|
4139 * 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
|
4140 * 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
|
4141 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4142 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
|
4143 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4144 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
|
4145 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
|
4146 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
|
4147 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
|
4148 "", |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4149 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
|
4150 (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
|
4151 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
|
4152 NULLHANDLE, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4153 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
|
4154 id, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4155 &sldcData, |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4156 NULL); |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4157 |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4158 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4159 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
|
4160 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
|
4161 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
|
4162 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4163 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4164 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4165 * Create a new percent bar window (widget) to be packed. |
3 | 4166 * Parameters: |
4167 * id: An ID to be used with WinWindowFromID() or 0L. | |
4168 */ | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4169 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
|
4170 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4171 WindowData *blah = calloc(1, sizeof(WindowData)); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4172 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
|
4173 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
|
4174 "", |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4175 WS_VISIBLE | SLS_READONLY |
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4176 | 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
|
4177 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
|
4178 NULLHANDLE, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4179 HWND_TOP, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4180 id, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4181 NULL, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4182 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
|
4183 dw_window_disable(tmp); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4184 blah->oldproc = WinSubclassWindow(tmp, _percentproc); |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4185 WinSetWindowPtr(tmp, QWP_USER, blah); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4186 return tmp; |
3 | 4187 } |
4188 | |
4189 /* | |
4190 * Create a new checkbox window (widget) to be packed. | |
4191 * Parameters: | |
4192 * text: The text to be display by the static text widget. | |
4193 * id: An ID to be used with WinWindowFromID() or 0L. | |
4194 */ | |
4195 HWND dw_checkbox_new(char *text, ULONG id) | |
4196 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4197 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4198 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4199 WC_BUTTON, | |
4200 text, | |
4201 WS_VISIBLE | BS_AUTOCHECKBOX, | |
4202 0,0,2000,1000, | |
4203 NULLHANDLE, | |
4204 HWND_TOP, | |
4205 id, | |
4206 NULL, | |
4207 NULL); | |
4208 dw_window_set_font(tmp, DefaultFont); | |
4209 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
|
4210 bubble->id = id; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4211 bubble->bubbletext[0] = '\0'; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4212 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4213 WinSetWindowPtr(tmp, QWP_USER, bubble); |
3 | 4214 return tmp; |
4215 } | |
4216 | |
4217 /* | |
4218 * Create a new listbox window (widget) to be packed. | |
4219 * Parameters: | |
4220 * id: An ID to be used with WinWindowFromID() or 0L. | |
4221 * multi: Multiple select TRUE or FALSE. | |
4222 */ | |
4223 HWND dw_listbox_new(ULONG id, int multi) | |
4224 { | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4225 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4226 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4227 WC_LISTBOX, | |
4228 NULL, | |
4229 WS_VISIBLE | LS_NOADJUSTPOS | | |
4230 (multi ? LS_MULTIPLESEL : 0), | |
4231 0,0,2000,1000, | |
4232 NULLHANDLE, | |
4233 HWND_TOP, | |
4234 id, | |
4235 NULL, | |
4236 NULL); | |
4237 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
|
4238 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4239 WinSetWindowPtr(tmp, QWP_USER, blah); |
4240 return tmp; | |
4241 } | |
4242 | |
4243 /* | |
4244 * Sets the icon used for a given window. | |
4245 * Parameters: | |
4246 * handle: Handle to the window. | |
4247 * id: An ID to be used to specify the icon. | |
4248 */ | |
4249 void dw_window_set_icon(HWND handle, ULONG id) | |
4250 { | |
4251 HPOINTER icon; | |
4252 | |
4253 icon = WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id); | |
4254 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0); | |
4255 } | |
4256 | |
4257 /* | |
4258 * Sets the bitmap used for a given static window. | |
4259 * Parameters: | |
4260 * handle: Handle to the window. | |
4261 * id: An ID to be used to specify the icon. | |
4262 */ | |
4263 void dw_window_set_bitmap(HWND handle, ULONG id) | |
4264 { | |
4265 HBITMAP hbm; | |
4266 HPS hps = WinGetPS(handle); | |
4267 | |
4268 hbm = GpiLoadBitmap(hps, NULLHANDLE, id, 0, 0); | |
4269 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f); | |
4270 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL ); | |
4271 /*WinSetWindowULong( hwndDlg, QWL_USER, (ULONG) hbm );*/ | |
4272 WinReleasePS(hps); | |
4273 } | |
4274 | |
4275 /* | |
4276 * Sets the text used for a given window. | |
4277 * Parameters: | |
4278 * handle: Handle to the window. | |
4279 * text: The text associsated with a given window. | |
4280 */ | |
4281 void dw_window_set_text(HWND handle, char *text) | |
4282 { | |
4283 WinSetWindowText(handle, text); | |
4284 } | |
4285 | |
4286 /* | |
4287 * Gets the text used for a given window. | |
4288 * Parameters: | |
4289 * handle: Handle to the window. | |
4290 * Returns: | |
4291 * text: The text associsated with a given window. | |
4292 */ | |
4293 char *dw_window_get_text(HWND handle) | |
4294 { | |
4295 char tempbuf[4096] = ""; | |
4296 | |
4297 WinQueryWindowText(handle, 4095, tempbuf); | |
4298 tempbuf[4095] = 0; | |
4299 | |
4300 return strdup(tempbuf); | |
4301 } | |
4302 | |
4303 /* | |
4304 * Disables given window (widget). | |
4305 * Parameters: | |
4306 * handle: Handle to the window. | |
4307 */ | |
4308 void dw_window_disable(HWND handle) | |
4309 { | |
4310 WinEnableWindow(handle, FALSE); | |
4311 } | |
4312 | |
4313 /* | |
4314 * Enables given window (widget). | |
4315 * Parameters: | |
4316 * handle: Handle to the window. | |
4317 */ | |
4318 void dw_window_enable(HWND handle) | |
4319 { | |
4320 WinEnableWindow(handle, TRUE); | |
4321 } | |
4322 | |
4323 /* | |
4324 * Gets the child window handle with specified ID. | |
4325 * Parameters: | |
4326 * handle: Handle to the parent window. | |
4327 * id: Integer ID of the child. | |
4328 */ | |
4329 HWND dw_window_from_id(HWND handle, int id) | |
4330 { | |
4331 HENUM henum; | |
4332 HWND child; | |
4333 char tmpbuf[100]; | |
4334 | |
4335 henum = WinBeginEnumWindows(handle); | |
4336 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
4337 { | |
4338 int windowid = WinQueryWindowUShort(child, QWS_ID); | |
4339 HWND found; | |
4340 | |
4341 WinQueryClassName(child, 99, tmpbuf); | |
4342 | |
4343 /* 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
|
4344 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 4345 if((found = dw_window_from_id(child, id)) != NULLHANDLE) |
4346 return found; | |
4347 | |
4348 if(windowid && windowid == id) | |
4349 { | |
4350 WinEndEnumWindows(henum); | |
4351 return child; | |
4352 } | |
4353 } | |
4354 WinEndEnumWindows(henum); | |
4355 return NULLHANDLE; | |
4356 } | |
4357 | |
4358 /* | |
4359 * Pack windows (widgets) into a box from the end (or bottom). | |
4360 * Parameters: | |
4361 * box: Window handle of the box to be packed into. | |
4362 * item: Window handle of the item to be back. | |
4363 * width: Width in pixels of the item or -1 to be self determined. | |
4364 * height: Height in pixels of the item or -1 to be self determined. | |
4365 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
4366 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
4367 * pad: Number of pixels of padding around the item. | |
4368 */ | |
4369 void dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
4370 { | |
4371 Box *thisbox; | |
4372 | |
4373 if(WinWindowFromID(box, FID_CLIENT)) | |
4374 { | |
4375 box = WinWindowFromID(box, FID_CLIENT); | |
4376 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4377 } | |
4378 else | |
4379 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4380 if(thisbox) | |
4381 { | |
4382 if(thisbox->type == BOXHORZ) | |
4383 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); | |
4384 else | |
4385 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); | |
4386 } | |
4387 } | |
4388 | |
4389 void dw_box_pack_end_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
4390 { | |
4391 Box *thisbox; | |
4392 | |
4393 if(WinWindowFromID(box, FID_CLIENT)) | |
4394 { | |
4395 box = WinWindowFromID(box, FID_CLIENT); | |
4396 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4397 hsize = TRUE; | |
4398 vsize = TRUE; | |
4399 } | |
4400 else | |
4401 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4402 if(!thisbox) | |
4403 { | |
4404 box = WinWindowFromID(box, FID_CLIENT); | |
4405 if(box) | |
4406 { | |
4407 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
4408 hsize = TRUE; | |
4409 vsize = TRUE; | |
4410 } | |
4411 } | |
4412 if(thisbox) | |
4413 { | |
4414 int z; | |
4415 Item *tmpitem, *thisitem = thisbox->items; | |
4416 char tmpbuf[100]; | |
4417 | |
4418 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
4419 | |
4420 for(z=0;z<thisbox->count;z++) | |
4421 { | |
4422 tmpitem[z] = thisitem[z]; | |
4423 } | |
4424 | |
4425 WinQueryClassName(item, 99, tmpbuf); | |
4426 | |
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
|
4427 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 4428 tmpitem[thisbox->count].type = TYPEBOX; |
4429 else | |
4430 tmpitem[thisbox->count].type = TYPEITEM; | |
4431 | |
4432 tmpitem[thisbox->count].hwnd = item; | |
4433 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width; | |
4434 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height; | |
4435 tmpitem[thisbox->count].pad = pad; | |
4436 if(hsize) | |
4437 tmpitem[thisbox->count].hsize = SIZEEXPAND; | |
4438 else | |
4439 tmpitem[thisbox->count].hsize = SIZESTATIC; | |
4440 | |
4441 if(vsize) | |
4442 tmpitem[thisbox->count].vsize = SIZEEXPAND; | |
4443 else | |
4444 tmpitem[thisbox->count].vsize = SIZESTATIC; | |
4445 | |
4446 thisbox->items = tmpitem; | |
4447 | |
4448 if(thisbox->count) | |
4449 free(thisitem); | |
4450 | |
4451 thisbox->count++; | |
4452 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
4453 /* Don't set the ownership if it's an entryfield or spinbutton */ |
3 | 4454 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
|
4455 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
|
4456 WinSetOwner(item, box); |
3 | 4457 WinSetParent(item, box, FALSE); |
4458 } | |
4459 } | |
4460 | |
4461 /* | |
4462 * Sets the size of a given window (widget). | |
4463 * Parameters: | |
4464 * handle: Window (widget) handle. | |
4465 * width: New width in pixels. | |
4466 * height: New height in pixels. | |
4467 */ | |
4468 void dw_window_set_usize(HWND handle, ULONG width, ULONG height) | |
4469 { | |
4470 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); | |
4471 } | |
4472 | |
4473 /* | |
4474 * Returns the width of the screen. | |
4475 */ | |
4476 int dw_screen_width(void) | |
4477 { | |
4478 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); | |
4479 } | |
4480 | |
4481 /* | |
4482 * Returns the height of the screen. | |
4483 */ | |
4484 int dw_screen_height(void) | |
4485 { | |
4486 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); | |
4487 } | |
4488 | |
4489 /* This should return the current color depth */ | |
4490 unsigned long dw_color_depth(void) | |
4491 { | |
4492 HDC hdc = WinOpenWindowDC(HWND_DESKTOP); | |
4493 long colors; | |
4494 | |
4495 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); | |
4496 DevCloseDC(hdc); | |
4497 return colors; | |
4498 } | |
4499 | |
4500 | |
4501 /* | |
4502 * Sets the position of a given window (widget). | |
4503 * Parameters: | |
4504 * handle: Window (widget) handle. | |
4505 * x: X location from the bottom left. | |
4506 * y: Y location from the bottom left. | |
4507 */ | |
4508 void dw_window_set_pos(HWND handle, ULONG x, ULONG y) | |
4509 { | |
4510 int myy = _get_frame_height(handle) - (y + _get_height(handle)); | |
4511 | |
4512 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE); | |
4513 } | |
4514 | |
4515 /* | |
4516 * Sets the position and size of a given window (widget). | |
4517 * Parameters: | |
4518 * handle: Window (widget) handle. | |
4519 * x: X location from the bottom left. | |
4520 * y: Y location from the bottom left. | |
4521 * width: Width of the widget. | |
4522 * height: Height of the widget. | |
4523 */ | |
4524 void dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) | |
4525 { | |
4526 int myy = _get_frame_height(handle) - (y + height); | |
4527 | |
4528 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); | |
4529 } | |
4530 | |
4531 /* | |
4532 * Gets the position and size of a given window (widget). | |
4533 * Parameters: | |
4534 * handle: Window (widget) handle. | |
4535 * x: X location from the bottom left. | |
4536 * y: Y location from the bottom left. | |
4537 * width: Width of the widget. | |
4538 * height: Height of the widget. | |
4539 */ | |
4540 void dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) | |
4541 { | |
4542 SWP swp; | |
4543 WinQueryWindowPos(handle, &swp); | |
4544 if(x) | |
4545 *x = swp.x; | |
4546 if(y) | |
4547 *y = _get_frame_height(handle) - (swp.y + swp.cy); | |
4548 if(width) | |
4549 *width = swp.cx; | |
4550 if(height) | |
4551 *height = swp.cy; | |
4552 } | |
4553 | |
4554 /* | |
4555 * Sets the style of a given window (widget). | |
4556 * Parameters: | |
4557 * handle: Window (widget) handle. | |
4558 * width: New width in pixels. | |
4559 * height: New height in pixels. | |
4560 */ | |
4561 void dw_window_set_style(HWND handle, ULONG style, ULONG mask) | |
4562 { | |
4563 WinSetWindowBits(handle, QWL_STYLE, style, mask); | |
4564 } | |
4565 | |
4566 /* | |
4567 * Adds a new page to specified notebook. | |
4568 * Parameters: | |
4569 * handle: Window (widget) handle. | |
4570 * flags: Any additional page creation flags. | |
4571 * front: If TRUE page is added at the beginning. | |
4572 */ | |
4573 ULONG dw_notebook_page_new(HWND handle, ULONG flags, int front) | |
4574 { | |
4575 if(front) | |
4576 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
4577 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_FIRST)); | |
4578 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
4579 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_LAST)); | |
4580 } | |
4581 | |
4582 /* | |
4583 * Remove a page from a notebook. | |
4584 * Parameters: | |
4585 * handle: Handle to the notebook widget. | |
4586 * pageid: ID of the page to be destroyed. | |
4587 */ | |
4588 void dw_notebook_page_destroy(HWND handle, unsigned int pageid) | |
4589 { | |
4590 WinSendMsg(handle, BKM_DELETEPAGE, | |
4591 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE); | |
4592 } | |
4593 | |
4594 /* | |
4595 * Queries the currently visible page ID. | |
4596 * Parameters: | |
4597 * handle: Handle to the notebook widget. | |
4598 */ | |
4599 unsigned int dw_notebook_page_query(HWND handle) | |
4600 { | |
4601 return (int)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR)); | |
4602 } | |
4603 | |
4604 /* | |
4605 * Sets the currently visibale page ID. | |
4606 * Parameters: | |
4607 * handle: Handle to the notebook widget. | |
4608 * pageid: ID of the page to be made visible. | |
4609 */ | |
4610 void dw_notebook_page_set(HWND handle, unsigned int pageid) | |
4611 { | |
4612 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L); | |
4613 } | |
4614 | |
4615 /* | |
4616 * Sets the text on the specified notebook tab. | |
4617 * Parameters: | |
4618 * handle: Notebook handle. | |
4619 * pageid: Page ID of the tab to set. | |
4620 * text: Pointer to the text to set. | |
4621 */ | |
4622 void dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) | |
4623 { | |
4624 WinSendMsg(handle, BKM_SETTABTEXT, | |
4625 MPFROMLONG(pageid), MPFROMP(text)); | |
4626 } | |
4627 | |
4628 /* | |
4629 * Sets the text on the specified notebook tab status area. | |
4630 * Parameters: | |
4631 * handle: Notebook handle. | |
4632 * pageid: Page ID of the tab to set. | |
4633 * text: Pointer to the text to set. | |
4634 */ | |
4635 void dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) | |
4636 { | |
4637 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, | |
4638 MPFROMLONG(pageid), MPFROMP(text)); | |
4639 } | |
4640 | |
4641 /* | |
4642 * Packs the specified box into the notebook page. | |
4643 * Parameters: | |
4644 * handle: Handle to the notebook to be packed. | |
4645 * pageid: Page ID in the notebook which is being packed. | |
4646 * page: Box handle to be packed. | |
4647 */ | |
4648 void dw_notebook_pack(HWND handle, ULONG pageid, HWND page) | |
4649 { | |
4650 HWND tmpbox = dw_box_new(BOXVERT, 0); | |
4651 | |
4652 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | |
4653 WinSubclassWindow(tmpbox, _wndproc); | |
4654 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, | |
4655 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); | |
4656 } | |
4657 | |
4658 /* | |
4659 * Appends the specified text to the listbox's (or combobox) entry list. | |
4660 * Parameters: | |
4661 * handle: Handle to the listbox to be appended to. | |
4662 * text: Text to append into listbox. | |
4663 */ | |
4664 void dw_listbox_append(HWND handle, char *text) | |
4665 { | |
4666 WinSendMsg(handle, | |
4667 LM_INSERTITEM, | |
4668 MPFROMSHORT(LIT_END), | |
4669 MPFROMP(text)); | |
4670 } | |
4671 | |
4672 /* | |
4673 * Clears the listbox's (or combobox) list of all entries. | |
4674 * Parameters: | |
4675 * handle: Handle to the listbox to be cleared. | |
4676 */ | |
4677 void dw_listbox_clear(HWND handle) | |
4678 { | |
4679 WinSendMsg(handle, | |
4680 LM_DELETEALL, 0L, 0L); | |
4681 } | |
4682 | |
4683 /* | |
4684 * Returns the listbox's item count. | |
4685 * Parameters: | |
4686 * handle: Handle to the listbox to be cleared. | |
4687 */ | |
4688 int dw_listbox_count(HWND handle) | |
4689 { | |
4690 return (int)WinSendMsg(handle, | |
4691 LM_QUERYITEMCOUNT,0L, 0L); | |
4692 } | |
4693 | |
4694 /* | |
4695 * Sets the topmost item in the viewport. | |
4696 * Parameters: | |
4697 * handle: Handle to the listbox to be cleared. | |
4698 * top: Index to the top item. | |
4699 */ | |
4700 void dw_listbox_set_top(HWND handle, int top) | |
4701 { | |
4702 WinSendMsg(handle, | |
4703 LM_SETTOPINDEX, | |
4704 MPFROMSHORT(top), | |
4705 0L); | |
4706 } | |
4707 | |
4708 /* | |
4709 * Copies the given index item's text into buffer. | |
4710 * Parameters: | |
4711 * handle: Handle to the listbox to be queried. | |
4712 * index: Index into the list to be queried. | |
4713 * buffer: Buffer where text will be copied. | |
4714 * length: Length of the buffer (including NULL). | |
4715 */ | |
4716 void dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) | |
4717 { | |
4718 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer); | |
4719 } | |
4720 | |
4721 /* | |
4722 * Sets the text of a given listbox entry. | |
4723 * Parameters: | |
4724 * handle: Handle to the listbox to be queried. | |
4725 * index: Index into the list to be queried. | |
4726 * buffer: Buffer where text will be copied. | |
4727 */ | |
4728 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) | |
4729 { | |
4730 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); | |
4731 } | |
4732 | |
4733 /* | |
4734 * Returns the index to the item in the list currently selected. | |
4735 * Parameters: | |
4736 * handle: Handle to the listbox to be queried. | |
4737 */ | |
4738 unsigned int dw_listbox_selected(HWND handle) | |
4739 { | |
4740 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
|
4741 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
|
4742 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
|
4743 0); |
3 | 4744 } |
4745 | |
4746 /* | |
4747 * Returns the index to the current selected item or -1 when done. | |
4748 * Parameters: | |
4749 * handle: Handle to the listbox to be queried. | |
4750 * where: Either the previous return or -1 to restart. | |
4751 */ | |
4752 int dw_listbox_selected_multi(HWND handle, int where) | |
4753 { | |
4754 int place = where; | |
4755 | |
4756 if(where == -1) | |
4757 place = LIT_FIRST; | |
4758 | |
4759 place = (int)WinSendMsg(handle, | |
4760 LM_QUERYSELECTION, | |
4761 MPFROMSHORT(place),0L); | |
4762 if(place == LIT_NONE) | |
4763 return -1; | |
4764 return place; | |
4765 } | |
4766 | |
4767 /* | |
4768 * Sets the selection state of a given index. | |
4769 * Parameters: | |
4770 * handle: Handle to the listbox to be set. | |
4771 * index: Item index. | |
4772 * state: TRUE if selected FALSE if unselected. | |
4773 */ | |
4774 void dw_listbox_select(HWND handle, int index, int state) | |
4775 { | |
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
|
4776 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
|
4777 |
3 | 4778 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
|
4779 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4780 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
|
4781 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
4782 /* 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
|
4783 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
|
4784 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); |
3 | 4785 } |
4786 | |
4787 /* | |
4788 * Deletes the item with given index from the list. | |
4789 * Parameters: | |
4790 * handle: Handle to the listbox to be set. | |
4791 * index: Item index. | |
4792 */ | |
4793 void dw_listbox_delete(HWND handle, int index) | |
4794 { | |
4795 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0); | |
4796 } | |
4797 | |
4798 /* | |
4799 * Adds text to an MLE box and returns the current point. | |
4800 * Parameters: | |
4801 * handle: Handle to the MLE to be queried. | |
4802 * buffer: Text buffer to be imported. | |
4803 * startpoint: Point to start entering text. | |
4804 */ | |
4805 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint) | |
4806 { | |
4807 unsigned long point = startpoint; | |
4808 PBYTE mlebuf; | |
4809 | |
4810 /* Work around 64K limit */ | |
4811 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
4812 { | |
4813 int amount, len = strlen(buffer), written = 0; | |
4814 | |
4815 while(written < len) | |
4816 { | |
4817 if((len - written) > 65535) | |
4818 amount = 65535; | |
4819 else | |
4820 amount = len - written; | |
4821 | |
4822 memcpy(mlebuf, &buffer[written], amount); | |
4823 mlebuf[amount] = '\0'; | |
4824 | |
4825 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1)); | |
4826 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); | |
4827 dw_mle_delete(handle, point, 1); | |
4828 | |
4829 written += amount; | |
4830 } | |
4831 DosFreeMem(mlebuf); | |
4832 } | |
4833 return point - 1; | |
4834 } | |
4835 | |
4836 /* | |
4837 * Grabs text from an MLE box. | |
4838 * Parameters: | |
4839 * handle: Handle to the MLE to be queried. | |
4840 * buffer: Text buffer to be exported. | |
4841 * startpoint: Point to start grabbing text. | |
4842 * length: Amount of text to be grabbed. | |
4843 */ | |
4844 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length) | |
4845 { | |
4846 PBYTE mlebuf; | |
4847 | |
4848 /* Work around 64K limit */ | |
4849 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
4850 { | |
4851 int amount, copied, written = 0; | |
4852 | |
4853 while(written < length) | |
4854 { | |
4855 if((length - written) > 65535) | |
4856 amount = 65535; | |
4857 else | |
4858 amount = length - written; | |
4859 | |
4860 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount)); | |
4861 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount)); | |
4862 | |
4863 if(copied) | |
4864 { | |
4865 memcpy(&buffer[written], mlebuf, copied); | |
4866 | |
4867 written += copied; | |
4868 } | |
4869 else | |
4870 break; | |
4871 } | |
4872 DosFreeMem(mlebuf); | |
4873 } | |
4874 } | |
4875 | |
4876 /* | |
4877 * Obtains information about an MLE box. | |
4878 * Parameters: | |
4879 * handle: Handle to the MLE to be queried. | |
4880 * bytes: A pointer to a variable to return the total bytes. | |
4881 * lines: A pointer to a variable to return the number of lines. | |
4882 */ | |
4883 void dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines) | |
4884 { | |
4885 if(bytes) | |
4886 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0); | |
4887 if(lines) | |
4888 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0); | |
4889 } | |
4890 | |
4891 /* | |
4892 * Deletes text from an MLE box. | |
4893 * Parameters: | |
4894 * handle: Handle to the MLE to be deleted from. | |
4895 * startpoint: Point to start deleting text. | |
4896 * length: Amount of text to be deleted. | |
4897 */ | |
4898 void dw_mle_delete(HWND handle, int startpoint, int length) | |
4899 { | |
4900 char *buf = malloc(length+1); | |
4901 int z, dellen = length; | |
4902 | |
4903 dw_mle_export(handle, buf, startpoint, length); | |
4904 | |
4905 for(z=0;z<length-1;z++) | |
4906 { | |
4907 if(strncmp(&buf[z], "\r\n", 2) == 0) | |
4908 dellen--; | |
4909 } | |
4910 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen)); | |
4911 free(buf); | |
4912 } | |
4913 | |
4914 /* | |
4915 * Clears all text from an MLE box. | |
4916 * Parameters: | |
4917 * handle: Handle to the MLE to be cleared. | |
4918 */ | |
4919 void dw_mle_clear(HWND handle) | |
4920 { | |
4921 unsigned long bytes; | |
4922 | |
4923 dw_mle_query(handle, &bytes, NULL); | |
4924 | |
4925 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes)); | |
4926 } | |
4927 | |
4928 /* | |
4929 * Sets the visible line of an MLE box. | |
4930 * Parameters: | |
4931 * handle: Handle to the MLE to be positioned. | |
4932 * line: Line to be visible. | |
4933 */ | |
4934 void dw_mle_set_visible(HWND handle, int line) | |
4935 { | |
4936 int tmppnt; | |
4937 | |
4938 if(line > 10) | |
4939 { | |
4940 tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line - 10), 0); | |
4941 WinSendMsg(handle, MLM_SETFIRSTCHAR, MPFROMLONG(tmppnt), 0); | |
4942 } | |
4943 } | |
4944 | |
4945 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4946 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4947 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4948 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4949 * 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
|
4950 */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4951 void dw_mle_set_editable(HWND handle, int state) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4952 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4953 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4954 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4955 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4956 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4957 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4958 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4959 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4960 * 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
|
4961 */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4962 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
|
4963 { |
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
|
4964 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4965 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4966 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4967 /* |
3 | 4968 * Sets the current cursor position of an MLE box. |
4969 * Parameters: | |
4970 * handle: Handle to the MLE to be positioned. | |
4971 * point: Point to position cursor. | |
4972 */ | |
4973 void dw_mle_set(HWND handle, int point) | |
4974 { | |
4975 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point)); | |
4976 } | |
4977 | |
4978 /* | |
4979 * Finds text in an MLE box. | |
4980 * Parameters: | |
4981 * handle: Handle to the MLE to be cleared. | |
4982 * text: Text to search for. | |
4983 * point: Start point of search. | |
4984 * flags: Search specific flags. | |
4985 */ | |
4986 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags) | |
4987 { | |
4988 MLE_SEARCHDATA msd; | |
4989 | |
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
|
4990 /* 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
|
4991 * 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
|
4992 */ |
3 | 4993 msd.cb = sizeof(msd); |
4994 msd.pchFind = text; | |
4995 msd.pchReplace = NULL; | |
4996 msd.cchFind = strlen(text); | |
4997 msd.cchReplace = 0; | |
4998 msd.iptStart = point; | |
4999 msd.iptStop = -1; | |
5000 | |
5001 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd)) | |
5002 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0); | |
5003 return 0; | |
5004 } | |
5005 | |
5006 /* | |
5007 * Stops redrawing of an MLE box. | |
5008 * Parameters: | |
5009 * handle: Handle to the MLE to freeze. | |
5010 */ | |
5011 void dw_mle_freeze(HWND handle) | |
5012 { | |
5013 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0); | |
5014 } | |
5015 | |
5016 /* | |
5017 * Resumes redrawing of an MLE box. | |
5018 * Parameters: | |
5019 * handle: Handle to the MLE to thaw. | |
5020 */ | |
5021 void dw_mle_thaw(HWND handle) | |
5022 { | |
5023 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); | |
5024 } | |
5025 | |
5026 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5027 * Returns the range of the percent bar. |
3 | 5028 * 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
|
5029 * handle: Handle to the percent bar to be queried. |
3 | 5030 */ |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5031 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
|
5032 { |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5033 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); |
3 | 5034 } |
5035 | |
5036 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5037 * Sets the percent bar position. |
3 | 5038 * 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
|
5039 * 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
|
5040 * position: Position of the percent bar withing the range. |
3 | 5041 */ |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5042 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
|
5043 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5044 _dw_int_set(handle, position); |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5045 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position); |
3 | 5046 } |
5047 | |
5048 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5049 * 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
|
5050 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5051 * 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
|
5052 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5053 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
|
5054 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5055 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
|
5056 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5057 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5058 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5059 * 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
|
5060 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5061 * 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
|
5062 * 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
|
5063 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5064 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
|
5065 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5066 dw_window_set_data(handle, "_dw_slider_value", (void *)position); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5067 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
|
5068 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5069 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5070 /* |
3 | 5071 * Sets the spinbutton value. |
5072 * Parameters: | |
5073 * handle: Handle to the spinbutton to be set. | |
5074 * position: Current value of the spinbutton. | |
5075 */ | |
5076 void dw_spinbutton_set_pos(HWND handle, long position) | |
5077 { | |
5078 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L); | |
5079 } | |
5080 | |
5081 /* | |
5082 * Sets the spinbutton limits. | |
5083 * Parameters: | |
5084 * handle: Handle to the spinbutton to be set. | |
5085 * upper: Upper limit. | |
5086 * lower: Lower limit. | |
5087 */ | |
5088 void dw_spinbutton_set_limits(HWND handle, long upper, long lower) | |
5089 { | |
5090 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower)); | |
5091 } | |
5092 | |
5093 /* | |
5094 * Sets the entryfield character limit. | |
5095 * Parameters: | |
5096 * handle: Handle to the spinbutton to be set. | |
5097 * limit: Number of characters the entryfield will take. | |
5098 */ | |
5099 void dw_entryfield_set_limit(HWND handle, ULONG limit) | |
5100 { | |
5101 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0); | |
5102 } | |
5103 | |
5104 | |
5105 /* | |
5106 * Returns the current value of the spinbutton. | |
5107 * Parameters: | |
5108 * handle: Handle to the spinbutton to be queried. | |
5109 */ | |
5110 long dw_spinbutton_query(HWND handle) | |
5111 { | |
5112 long tmpval = 0L; | |
5113 | |
5114 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L); | |
5115 return tmpval; | |
5116 } | |
5117 | |
5118 /* | |
5119 * Returns the state of the checkbox. | |
5120 * Parameters: | |
5121 * handle: Handle to the checkbox to be queried. | |
5122 */ | |
5123 int dw_checkbox_query(HWND handle) | |
5124 { | |
5125 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0); | |
5126 } | |
5127 | |
5128 /* | |
5129 * Sets the state of the checkbox. | |
5130 * Parameters: | |
5131 * handle: Handle to the checkbox to be queried. | |
5132 * value: TRUE for checked, FALSE for unchecked. | |
5133 */ | |
5134 void dw_checkbox_set(HWND handle, int value) | |
5135 { | |
5136 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0); | |
5137 } | |
5138 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5139 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5140 * 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
|
5141 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5142 * 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
|
5143 * 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
|
5144 * 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
|
5145 * 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
|
5146 * 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
|
5147 * 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
|
5148 */ |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5149 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
|
5150 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5151 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
|
5152 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
|
5153 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
|
5154 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5155 if(!item) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5156 item = CMA_FIRST; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5157 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5158 /* 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
|
5159 * 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
|
5160 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5161 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5162 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
|
5163 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5164 /* 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
|
5165 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5166 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
|
5167 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5168 /* 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
|
5169 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5170 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
|
5171 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
|
5172 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
|
5173 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5174 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
|
5175 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
|
5176 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5177 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
|
5178 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5179 ri.cb = sizeof(RECORDINSERT); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5180 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
|
5181 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
|
5182 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
|
5183 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
|
5184 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
|
5185 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5186 /* 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
|
5187 * 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
|
5188 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5189 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
|
5190 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5191 /* 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
|
5192 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
|
5193 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5194 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
|
5195 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5196 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5197 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5198 * 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
|
5199 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5200 * 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
|
5201 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5202 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5203 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5204 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5205 */ |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5206 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
|
5207 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5208 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
|
5209 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5210 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5211 /* |
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
|
5212 * 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
|
5213 * 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
|
5214 * 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
|
5215 * 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
|
5216 * 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
|
5217 * 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
|
5218 */ |
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
|
5219 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
|
5220 { |
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
|
5221 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
|
5222 |
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
|
5223 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
|
5224 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
|
5225 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5226 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
|
5227 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
|
5228 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5229 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
|
5230 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
|
5231 |
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
|
5232 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
|
5233 |
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
|
5234 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
|
5235 } |
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
|
5236 |
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
|
5237 /* |
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
|
5238 * 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
|
5239 * 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
|
5240 * 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
|
5241 * 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
|
5242 * 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
|
5243 */ |
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
|
5244 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
|
5245 { |
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
|
5246 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
|
5247 |
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
|
5248 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
|
5249 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
|
5250 |
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
|
5251 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
|
5252 } |
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
|
5253 |
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
|
5254 /* |
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
|
5255 * 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
|
5256 * 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
|
5257 * 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
|
5258 * 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
|
5259 */ |
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
|
5260 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
|
5261 { |
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
|
5262 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
|
5263 |
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
|
5264 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
|
5265 { |
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
|
5266 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
|
5267 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
|
5268 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
|
5269 } |
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
|
5270 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
|
5271 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5272 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
|
5273 } |
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
|
5274 |
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
|
5275 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5276 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5277 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5278 * 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
|
5279 */ |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5280 void dw_tree_clear(HWND handle) |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5281 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5282 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
|
5283 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5284 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5285 /* |
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
|
5286 * 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
|
5287 * 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
|
5288 * 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
|
5289 * 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
|
5290 */ |
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
|
5291 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
|
5292 { |
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
|
5293 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
|
5294 } |
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
|
5295 |
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
|
5296 /* |
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
|
5297 * 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
|
5298 * 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
|
5299 * 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
|
5300 * 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
|
5301 */ |
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
|
5302 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
|
5303 { |
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
|
5304 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
|
5305 } |
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
|
5306 |
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
|
5307 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5308 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5309 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5310 * 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
|
5311 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5312 */ |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5313 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
|
5314 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5315 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
|
5316 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5317 if(!item) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5318 return; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5319 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5320 if(pci->rc.pszIcon) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5321 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5322 free(pci->rc.pszIcon); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5323 pci->rc.pszIcon = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5324 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5325 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5326 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
|
5327 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5328 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5329 /* 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
|
5330 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
|
5331 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
|
5332 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
|
5333 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
|
5334 } ContainerInfo; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5335 |
3 | 5336 /* |
5337 * Sets up the container columns. | |
5338 * Parameters: | |
5339 * handle: Handle to the container to be configured. | |
5340 * flags: An array of unsigned longs with column flags. | |
5341 * titles: An array of strings with column text titles. | |
5342 * count: The number of columns (this should match the arrays). | |
5343 * separator: The column number that contains the main separator. | |
5344 * (this item may only be used in OS/2) | |
5345 */ | |
5346 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) | |
5347 { | |
5348 PFIELDINFO details, first, left = NULL; | |
5349 FIELDINFOINSERT detin; | |
5350 CNRINFO cnri; | |
5351 int z; | |
5352 ULONG size = sizeof(RECORDCORE); | |
5353 ULONG *offStruct = malloc(count * sizeof(ULONG)); | |
5354 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
|
5355 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
|
5356 ULONG *oldflags = blah ? blah->data : 0; |
3 | 5357 |
5358 if(!offStruct || !tempflags) | |
5359 return FALSE; | |
5360 | |
5361 memcpy(tempflags, flags, count * sizeof(ULONG)); | |
5362 tempflags[count] = 0; | |
5363 | |
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
|
5364 blah->data = tempflags; |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5365 blah->flags = separator; |
3 | 5366 |
5367 if(oldflags) | |
5368 free(oldflags); | |
5369 | |
5370 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL) | |
5371 { | |
5372 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE)); | |
5373 } | |
5374 | |
5375 /* Figure out the offsets to the items in the struct */ | |
5376 for(z=0;z<count;z++) | |
5377 { | |
5378 offStruct[z] = size; | |
5379 if(flags[z] & DW_CFA_BITMAPORICON) | |
5380 size += sizeof(HPOINTER); | |
5381 else if(flags[z] & DW_CFA_STRING) | |
5382 size += sizeof(char *); | |
5383 else if(flags[z] & DW_CFA_ULONG) | |
5384 size += sizeof(ULONG); | |
5385 else if(flags[z] & DW_CFA_DATE) | |
5386 size += sizeof(CDATE); | |
5387 else if(flags[z] & DW_CFA_TIME) | |
5388 size += sizeof(CTIME); | |
5389 } | |
5390 | |
5391 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L); | |
5392 | |
5393 if(!first) | |
5394 { | |
5395 free(offStruct); | |
5396 return FALSE; | |
5397 } | |
5398 | |
5399 for(z=0;z<count;z++) | |
5400 { | |
5401 if(z==separator-1) | |
5402 left=details; | |
5403 details->cb = sizeof(FIELDINFO); | |
5404 details->flData = flags[z]; | |
5405 details->flTitle = CFA_FITITLEREADONLY; | |
5406 details->pTitleData = titles[z]; | |
5407 details->offStruct = offStruct[z]; | |
5408 details = details->pNextFieldInfo; | |
5409 } | |
5410 | |
5411 detin.cb = sizeof(FIELDINFOINSERT); | |
5412 detin.fInvalidateFieldInfo = FALSE; | |
5413 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST; | |
5414 detin.cFieldInfoInsert = (ULONG)count; | |
5415 | |
5416 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin)); | |
5417 | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
5418 if(count > separator && separator > 0) |
3 | 5419 { |
5420 cnri.cb = sizeof(CNRINFO); | |
5421 cnri.pFieldInfoLast = left; | |
5422 cnri.xVertSplitbar = 150; | |
5423 | |
5424 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR)); | |
5425 } | |
5426 | |
5427 free(offStruct); | |
5428 return TRUE; | |
5429 } | |
5430 | |
5431 /* | |
5432 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
5433 * Parameters: | |
5434 * handle: Handle to the container to be configured. | |
5435 * flags: An array of unsigned longs with column flags. | |
5436 * titles: An array of strings with column text titles. | |
5437 * count: The number of columns (this should match the arrays). | |
5438 */ | |
5439 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) | |
5440 { | |
5441 char **newtitles = malloc(sizeof(char *) * (count + 2)); | |
5442 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); | |
5443 | |
5444 newtitles[0] = "Icon"; | |
5445 newtitles[1] = "Filename"; | |
5446 | |
5447 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR; | |
5448 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | |
5449 | |
5450 memcpy(&newtitles[2], titles, sizeof(char *) * count); | |
5451 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); | |
5452 | |
103
babc1ea53d79
If dw_filesystem_setup is called with 0 additional columns then don't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
97
diff
changeset
|
5453 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0); |
3 | 5454 |
5455 free(newtitles); | |
5456 free(newflags); | |
5457 return TRUE; | |
5458 } | |
5459 | |
5460 /* | |
5461 * Obtains an icon from a module (or header in GTK). | |
5462 * Parameters: | |
5463 * module: Handle to module (DLL) in OS/2 and Windows. | |
5464 * id: A unsigned long id int the resources on OS/2 and | |
5465 * Windows, on GTK this is converted to a pointer | |
5466 * to an embedded XPM. | |
5467 */ | |
5468 unsigned long dw_icon_load(unsigned long module, unsigned long id) | |
5469 { | |
5470 return WinLoadPointer(HWND_DESKTOP,module,id); | |
5471 } | |
5472 | |
5473 /* | |
5474 * Frees a loaded resource in OS/2 and Windows. | |
5475 * Parameters: | |
5476 * handle: Handle to icon returned by dw_icon_load(). | |
5477 */ | |
5478 void dw_icon_free(unsigned long handle) | |
5479 { | |
5480 WinDestroyPointer(handle); | |
5481 } | |
5482 | |
5483 /* | |
5484 * Allocates memory used to populate a container. | |
5485 * Parameters: | |
5486 * handle: Handle to the container window (widget). | |
5487 * rowcount: The number of items to be populated. | |
5488 */ | |
5489 void *dw_container_alloc(HWND handle, int rowcount) | |
5490 { | |
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
|
5491 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
|
5492 ULONG *flags = wd ? wd->data : 0; |
3 | 5493 int z, size = 0, totalsize, count = 0; |
5494 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
|
5495 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
|
5496 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
|
5497 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5498 if(!flags || rowcount < 1) |
3 | 5499 return NULL; |
5500 | |
5501 while(flags[count]) | |
5502 count++; | |
5503 | |
5504 /* Figure out the offsets to the items in the struct */ | |
5505 for(z=0;z<count;z++) | |
5506 { | |
5507 if(flags[z] & DW_CFA_BITMAPORICON) | |
5508 size += sizeof(HPOINTER); | |
5509 else if(flags[z] & DW_CFA_STRING) | |
5510 size += sizeof(char *); | |
5511 else if(flags[z] & DW_CFA_ULONG) | |
5512 size += sizeof(ULONG); | |
5513 else if(flags[z] & DW_CFA_DATE) | |
5514 size += sizeof(CDATE); | |
5515 else if(flags[z] & DW_CFA_TIME) | |
5516 size += sizeof(CTIME); | |
5517 } | |
5518 | |
5519 totalsize = size + sizeof(RECORDCORE); | |
5520 | |
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
|
5521 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
|
5522 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5523 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
|
5524 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5525 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
|
5526 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
|
5527 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5528 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
|
5529 } |
3 | 5530 |
5531 if(!blah) | |
5532 return NULL; | |
5533 | |
5534 temp = (PRECORDCORE)blah; | |
5535 | |
5536 for(z=0;z<rowcount;z++) | |
5537 { | |
5538 temp->cb = totalsize; | |
5539 temp = temp->preccNextRecord; | |
5540 } | |
5541 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5542 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
|
5543 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5544 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
|
5545 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
|
5546 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
|
5547 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5548 return (void *)ci; |
3 | 5549 } |
5550 | |
5551 /* | |
5552 * Sets an item in specified row and column to the given data. | |
5553 * Parameters: | |
5554 * handle: Handle to the container window (widget). | |
5555 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5556 * column: Zero based column of data being set. | |
5557 * row: Zero based row of data being set. | |
5558 * data: Pointer to the data to be added. | |
5559 */ | |
5560 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) | |
5561 { | |
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
|
5562 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
|
5563 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
|
5564 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
|
5565 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
|
5566 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
|
5567 CNRINFO cnr; |
3 | 5568 void *dest; |
5569 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5570 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
|
5571 return; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5572 |
3 | 5573 if(!flags) |
5574 return; | |
5575 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5576 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
|
5577 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5578 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5579 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5580 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
|
5581 { |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5582 z++; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5583 if(z > 5000000) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5584 return; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5585 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
|
5586 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5587 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
|
5588 |
3 | 5589 /* Figure out the offsets to the items in the struct */ |
5590 for(z=0;z<column;z++) | |
5591 { | |
5592 if(flags[z] & DW_CFA_BITMAPORICON) | |
5593 size += sizeof(HPOINTER); | |
5594 else if(flags[z] & DW_CFA_STRING) | |
5595 size += sizeof(char *); | |
5596 else if(flags[z] & DW_CFA_ULONG) | |
5597 size += sizeof(ULONG); | |
5598 else if(flags[z] & DW_CFA_DATE) | |
5599 size += sizeof(CDATE); | |
5600 else if(flags[z] & DW_CFA_TIME) | |
5601 size += sizeof(CTIME); | |
5602 } | |
5603 | |
5604 totalsize = size + sizeof(RECORDCORE); | |
5605 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5606 for(z=0;z<(row-currentcount);z++) |
3 | 5607 temp = temp->preccNextRecord; |
5608 | |
5609 dest = (void *)(((ULONG)temp)+((ULONG)totalsize)); | |
5610 | |
5611 if(flags[column] & DW_CFA_BITMAPORICON) | |
5612 memcpy(dest, data, sizeof(HPOINTER)); | |
5613 else if(flags[column] & DW_CFA_STRING) | |
5614 memcpy(dest, data, sizeof(char *)); | |
5615 else if(flags[column] & DW_CFA_ULONG) | |
5616 memcpy(dest, data, sizeof(ULONG)); | |
5617 else if(flags[column] & DW_CFA_DATE) | |
5618 memcpy(dest, data, sizeof(CDATE)); | |
5619 else if(flags[column] & DW_CFA_TIME) | |
5620 memcpy(dest, data, sizeof(CTIME)); | |
5621 } | |
5622 | |
5623 /* | |
5624 * Sets an item in specified row and column to the given data. | |
5625 * Parameters: | |
5626 * handle: Handle to the container window (widget). | |
5627 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5628 * column: Zero based column of data being set. | |
5629 * row: Zero based row of data being set. | |
5630 * data: Pointer to the data to be added. | |
5631 */ | |
5632 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) | |
5633 { | |
5634 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); | |
5635 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); | |
5636 } | |
5637 | |
5638 /* | |
5639 * Sets an item in specified row and column to the given data. | |
5640 * Parameters: | |
5641 * handle: Handle to the container window (widget). | |
5642 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5643 * column: Zero based column of data being set. | |
5644 * row: Zero based row of data being set. | |
5645 * data: Pointer to the data to be added. | |
5646 */ | |
5647 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) | |
5648 { | |
5649 dw_container_set_item(handle, pointer, column + 2, row, data); | |
5650 } | |
5651 | |
5652 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5653 * 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
|
5654 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5655 * 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
|
5656 * 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
|
5657 * 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
|
5658 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5659 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
|
5660 { |
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 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5663 /* |
3 | 5664 * Sets the title of a row in the container. |
5665 * Parameters: | |
5666 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5667 * row: Zero based row of data being set. | |
5668 * title: String title of the item. | |
5669 */ | |
5670 void dw_container_set_row_title(void *pointer, int row, char *title) | |
5671 { | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5672 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
|
5673 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
|
5674 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
|
5675 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
|
5676 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5677 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5678 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5679 |
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
|
5680 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
|
5681 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5682 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5683 |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5684 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
|
5685 { |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5686 z++; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5687 if(z > 5000000) |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5688 return; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5689 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
|
5690 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5691 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
|
5692 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5693 for(z=0;z<(row-currentcount);z++) |
3 | 5694 temp = temp->preccNextRecord; |
5695 | |
5696 temp->pszIcon = title; | |
5697 temp->pszName = title; | |
5698 temp->pszText = title; | |
5699 } | |
5700 | |
5701 /* | |
5702 * Sets the title of a row in the container. | |
5703 * Parameters: | |
5704 * handle: Handle to the container window (widget). | |
5705 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
5706 * rowcount: The number of rows to be inserted. | |
5707 */ | |
5708 void dw_container_insert(HWND handle, void *pointer, int rowcount) | |
5709 { | |
5710 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
|
5711 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
|
5712 int z; |
3 | 5713 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5714 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5715 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
5716 |
3 | 5717 recin.cb = sizeof(RECORDINSERT); |
5718 recin.pRecordOrder = (PRECORDCORE)CMA_END; | |
5719 recin.pRecordParent = NULL; | |
5720 recin.zOrder = CMA_TOP; | |
5721 recin.fInvalidateRecord = TRUE; | |
5722 recin.cRecordsInsert = rowcount; | |
5723 | |
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
|
5724 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
|
5725 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5726 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
|
5727 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5728 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
|
5729 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
|
5730 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5731 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
|
5732 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5733 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5734 free(ci); |
3 | 5735 } |
5736 | |
5737 /* | |
5738 * Removes all rows from a container. | |
5739 * Parameters: | |
5740 * 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
|
5741 * 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
|
5742 */ |
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
5743 void dw_container_clear(HWND handle, int redraw) |
3 | 5744 { |
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
|
5745 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
|
5746 |
52
0804483f6320
Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
49
diff
changeset
|
5747 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
|
5748 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5749 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
|
5750 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
|
5751 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5752 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
|
5753 } |
3 | 5754 } |
5755 | |
5756 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5757 * 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
|
5758 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5759 * 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
|
5760 * 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
|
5761 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5762 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
|
5763 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5764 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
|
5765 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
|
5766 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5767 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
|
5768 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5769 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
|
5770 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5771 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
|
5772 current++; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5773 } |
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
|
5774 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5775 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
|
5776 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5777 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
|
5778 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5779 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
|
5780 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
|
5781 break; |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
5782 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
|
5783 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5784 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5785 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
|
5786 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5787 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5788 /* |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5789 * 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
|
5790 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5791 * 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
|
5792 * 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
|
5793 * 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
|
5794 * 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
|
5795 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5796 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
|
5797 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5798 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
|
5799 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5800 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
|
5801 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
|
5802 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5803 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
|
5804 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
|
5805 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5806 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5807 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5808 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5809 /* |
3 | 5810 * Removes all rows from a container. |
5811 * Parameters: | |
5812 * handle: Handle to the window (widget) to be cleared. | |
5813 */ | |
5814 void dw_container_set_view(HWND handle, unsigned long flags, int iconwidth, int iconheight) | |
5815 { | |
5816 CNRINFO cnrinfo; | |
5817 | |
5818 cnrinfo.flWindowAttr = flags; | |
5819 cnrinfo.slBitmapOrIcon.cx = iconwidth; | |
5820 cnrinfo.slBitmapOrIcon.cy = iconheight; | |
5821 | |
5822 WinSendMsg(handle, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON)); | |
5823 } | |
5824 | |
5825 /* | |
5826 * Starts a new query of a container. | |
5827 * Parameters: | |
5828 * handle: Handle to the window (widget) to be queried. | |
5829 * flags: If this parameter is DW_CRA_SELECTED it will only | |
5830 * return items that are currently selected. Otherwise | |
5831 * it will return all records in the container. | |
5832 */ | |
5833 char *dw_container_query_start(HWND handle, unsigned long flags) | |
5834 { | |
5835 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | |
5836 if(pCore) | |
5837 { | |
5838 if(flags) | |
5839 { | |
5840 while(pCore) | |
5841 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5842 if(pCore->flRecordAttr & flags) |
3 | 5843 return pCore->pszIcon; |
5844 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
5845 } | |
5846 } | |
5847 else | |
5848 return pCore->pszIcon; | |
5849 } | |
5850 return NULL; | |
5851 } | |
5852 | |
5853 /* | |
5854 * Continues an existing query of a container. | |
5855 * Parameters: | |
5856 * handle: Handle to the window (widget) to be queried. | |
5857 * flags: If this parameter is DW_CRA_SELECTED it will only | |
5858 * return items that are currently selected. Otherwise | |
5859 * it will return all records in the container. | |
5860 */ | |
5861 char *dw_container_query_next(HWND handle, unsigned long flags) | |
5862 { | |
5863 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
5864 if(pCore) | |
5865 { | |
5866 if(flags) | |
5867 { | |
5868 while(pCore) | |
5869 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5870 if(pCore->flRecordAttr & flags) |
3 | 5871 return pCore->pszIcon; |
5872 | |
5873 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
5874 } | |
5875 } | |
5876 else | |
5877 return pCore->pszIcon; | |
5878 } | |
5879 return NULL; | |
5880 } | |
5881 | |
5882 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5883 * 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
|
5884 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5885 * 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
|
5886 * 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
|
5887 */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5888 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
|
5889 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5890 RECTL viewport, item; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5891 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5892 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
|
5893 while(pCore) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5894 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5895 if(pCore->pszIcon == text) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5896 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5897 QUERYRECORDRECT qrr; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5898 int scrollpixels = 0, midway; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5899 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5900 qrr.cb = sizeof(QUERYRECORDRECT); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5901 qrr.pRecord = pCore; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5902 qrr.fRightSplitWindow = 0; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5903 qrr.fsExtent = CMA_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5904 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5905 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
|
5906 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
|
5907 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
|
5908 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5909 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
|
5910 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
|
5911 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5912 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
|
5913 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5914 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5915 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5916 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
|
5917 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5918 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5919 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5920 /* |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5921 * 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
|
5922 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5923 * 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
|
5924 */ |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5925 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
|
5926 { |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5927 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
|
5928 RECTL item; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5929 PRECORDCORE pCore = NULL; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5930 int max = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5931 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5932 if(blah && !blah->flags) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5933 return; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5934 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5935 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
|
5936 while(pCore) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5937 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5938 QUERYRECORDRECT qrr; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5939 int vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5940 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5941 qrr.cb = sizeof(QUERYRECORDRECT); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5942 qrr.pRecord = pCore; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5943 qrr.fRightSplitWindow = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5944 qrr.fsExtent = CMA_TEXT; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5945 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5946 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
|
5947 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5948 vector = item.xRight - item.xLeft; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5949 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5950 if(vector > max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5951 max = vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5952 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5953 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
|
5954 } |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5955 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5956 if(max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5957 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5958 CNRINFO cnri; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5959 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5960 cnri.cb = sizeof(CNRINFO); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5961 cnri.xVertSplitbar = max; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5962 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
5963 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
|
5964 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5965 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5966 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
5967 /* |
3 | 5968 * Creates a rendering context widget (window) to be packed. |
5969 * Parameters: | |
5970 * id: An id to be used with dw_window_from_id. | |
5971 * Returns: | |
5972 * A handle to the widget or NULL on failure. | |
5973 */ | |
5974 HWND dw_render_new(unsigned long id) | |
5975 { | |
5976 HWND hwndframe = WinCreateWindow(HWND_OBJECT, | |
5977 WC_FRAME, | |
5978 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
|
5979 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
|
5980 FS_NOBYTEALIGN, |
3 | 5981 0,0,2000,1000, |
5982 NULLHANDLE, | |
5983 HWND_TOP, | |
5984 id, | |
5985 NULL, | |
5986 NULL); | |
5987 WinSubclassWindow(hwndframe, _RendProc); | |
5988 return hwndframe; | |
5989 } | |
5990 | |
5991 /* Sets the current foreground drawing color. | |
5992 * Parameters: | |
5993 * red: red value. | |
5994 * green: green value. | |
5995 * blue: blue value. | |
5996 */ | |
5997 void dw_color_foreground_set(unsigned long value) | |
5998 { | |
5999 _foreground = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value); | |
6000 } | |
6001 | |
6002 /* Sets the current background drawing color. | |
6003 * Parameters: | |
6004 * red: red value. | |
6005 * green: green value. | |
6006 * blue: blue value. | |
6007 */ | |
6008 void dw_color_background_set(unsigned long value) | |
6009 { | |
6010 _background = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value); | |
6011 } | |
6012 | |
6013 HPS _set_hps(HPS hps) | |
6014 { | |
6015 LONG alTable[18]; | |
6016 | |
6017 GpiQueryLogColorTable(hps, 0L, 0L, 18L, alTable); | |
6018 | |
6019 alTable[16] = _foreground; | |
6020 alTable[17] = _background; | |
6021 | |
6022 GpiCreateLogColorTable(hps, | |
6023 0L, | |
6024 LCOLF_CONSECRGB, | |
6025 0L, | |
6026 18, | |
6027 alTable); | |
6028 GpiSetColor(hps, 16); | |
6029 GpiSetBackColor(hps, 17); | |
6030 return hps; | |
6031 } | |
6032 | |
6033 HPS _set_colors(HWND handle) | |
6034 { | |
6035 HPS hps = WinGetPS(handle); | |
6036 | |
6037 _set_hps(hps); | |
6038 return hps; | |
6039 } | |
6040 | |
6041 /* Draw a point on a window (preferably a render window). | |
6042 * Parameters: | |
6043 * handle: Handle to the window. | |
6044 * pixmap: Handle to the pixmap. (choose only one of these) | |
6045 * x: X coordinate. | |
6046 * y: Y coordinate. | |
6047 */ | |
6048 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) | |
6049 { | |
6050 HPS hps; | |
6051 int height; | |
6052 POINTL ptl; | |
6053 | |
6054 if(handle) | |
6055 { | |
6056 hps = _set_colors(handle); | |
6057 height = _get_height(handle); | |
6058 } | |
6059 else if(pixmap) | |
6060 { | |
6061 hps = _set_hps(pixmap->hps); | |
6062 height = pixmap->height; | |
6063 } | |
6064 else | |
6065 return; | |
6066 | |
6067 ptl.x = x; | |
6068 ptl.y = height - y - 1; | |
6069 | |
6070 GpiSetPel(hps, &ptl); | |
6071 if(!pixmap) | |
6072 WinReleasePS(hps); | |
6073 } | |
6074 | |
6075 /* Draw a line on a window (preferably a render window). | |
6076 * Parameters: | |
6077 * handle: Handle to the window. | |
6078 * pixmap: Handle to the pixmap. (choose only one of these) | |
6079 * x1: First X coordinate. | |
6080 * y1: First Y coordinate. | |
6081 * x2: Second X coordinate. | |
6082 * y2: Second Y coordinate. | |
6083 */ | |
6084 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) | |
6085 { | |
6086 HPS hps; | |
6087 int height; | |
6088 POINTL ptl[2]; | |
6089 | |
6090 if(handle) | |
6091 { | |
6092 hps = _set_colors(handle); | |
6093 height = _get_height(handle); | |
6094 } | |
6095 else if(pixmap) | |
6096 { | |
6097 hps = _set_hps(pixmap->hps); | |
6098 height = pixmap->height; | |
6099 } | |
6100 else | |
6101 return; | |
6102 | |
6103 ptl[0].x = x1; | |
6104 ptl[0].y = height - y1 - 1; | |
6105 ptl[1].x = x2; | |
6106 ptl[1].y = height - y2 - 1; | |
6107 | |
6108 GpiMove(hps, &ptl[0]); | |
6109 GpiLine(hps, &ptl[1]); | |
6110 | |
6111 if(!pixmap) | |
6112 WinReleasePS(hps); | |
6113 } | |
6114 | |
6115 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6116 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
|
6117 { |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6118 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
|
6119 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
|
6120 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
|
6121 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6122 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
|
6123 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6124 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
|
6125 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6126 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
|
6127 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
|
6128 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
|
6129 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6130 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
|
6131 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
|
6132 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6133 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
|
6134 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
|
6135 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
|
6136 } |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6137 |
3 | 6138 /* Draw text on a window (preferably a render window). |
6139 * Parameters: | |
6140 * handle: Handle to the window. | |
6141 * pixmap: Handle to the pixmap. (choose only one of these) | |
6142 * x: X coordinate. | |
6143 * y: Y coordinate. | |
6144 * text: Text to be displayed. | |
6145 */ | |
6146 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) | |
6147 { | |
6148 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
|
6149 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
|
6150 RECTL rcl; |
3 | 6151 char fontname[128]; |
6152 | |
6153 if(handle) | |
6154 { | |
6155 hps = _set_colors(handle); | |
6156 height = _get_height(handle); | |
6157 _GetPPFont(handle, fontname); | |
6158 } | |
6159 else if(pixmap) | |
6160 { | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6161 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
|
6162 |
3 | 6163 hps = _set_hps(pixmap->hps); |
6164 height = pixmap->height; | |
6165 _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
|
6166 _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
|
6167 WinReleasePS(pixmaphps); |
3 | 6168 } |
6169 else | |
6170 return; | |
6171 | |
6172 for(z=0;z<strlen(fontname);z++) | |
6173 { | |
6174 if(fontname[z]=='.') | |
6175 break; | |
6176 } | |
6177 size = atoi(fontname); | |
6178 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6179 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
|
6180 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
|
6181 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
|
6182 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
|
6183 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6184 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
3 | 6185 |
6186 if(!pixmap) | |
6187 WinReleasePS(hps); | |
6188 } | |
6189 | |
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
|
6190 /* 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
|
6191 * 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
|
6192 * 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
|
6193 * 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
|
6194 * 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
|
6195 * 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
|
6196 * 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
|
6197 */ |
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
|
6198 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
|
6199 { |
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
|
6200 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
|
6201 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
|
6202 |
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
|
6203 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
|
6204 { |
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
|
6205 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
|
6206 } |
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
|
6207 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
|
6208 { |
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
|
6209 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
|
6210 |
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
|
6211 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
|
6212 _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
|
6213 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
|
6214 } |
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
|
6215 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
|
6216 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
|
6217 |
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
|
6218 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
|
6219 |
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
|
6220 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
|
6221 *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
|
6222 |
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
|
6223 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
|
6224 *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
|
6225 |
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
|
6226 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
|
6227 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
|
6228 } |
3 | 6229 |
6230 /* Draw a rectangle on a window (preferably a render window). | |
6231 * Parameters: | |
6232 * handle: Handle to the window. | |
6233 * pixmap: Handle to the pixmap. (choose only one of these) | |
6234 * fill: Fill box TRUE or FALSE. | |
6235 * x: X coordinate. | |
6236 * y: Y coordinate. | |
6237 * width: Width of rectangle. | |
6238 * height: Height of rectangle. | |
6239 */ | |
6240 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) | |
6241 { | |
6242 HPS hps; | |
6243 int thisheight; | |
6244 POINTL ptl[2]; | |
6245 | |
6246 if(handle) | |
6247 { | |
6248 hps = _set_colors(handle); | |
6249 thisheight = _get_height(handle); | |
6250 } | |
6251 else if(pixmap) | |
6252 { | |
6253 hps = _set_hps(pixmap->hps); | |
6254 thisheight = pixmap->height; | |
6255 } | |
6256 else | |
6257 return; | |
6258 | |
6259 ptl[0].x = x; | |
6260 ptl[0].y = thisheight - y - 1; | |
6261 ptl[1].x = x + width - 1; | |
6262 ptl[1].y = thisheight - y - height; | |
6263 | |
6264 GpiMove(hps, &ptl[0]); | |
6265 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); | |
6266 | |
6267 if(!pixmap) | |
6268 WinReleasePS(hps); | |
6269 } | |
6270 | |
6271 /* Call this after drawing to the screen to make sure | |
6272 * anything you have drawn is visible. | |
6273 */ | |
6274 void dw_flush(void) | |
6275 { | |
6276 } | |
6277 | |
6278 /* | |
6279 * Creates a pixmap with given parameters. | |
6280 * Parameters: | |
6281 * handle: Window handle the pixmap is associated with. | |
6282 * width: Width of the pixmap in pixels. | |
6283 * height: Height of the pixmap in pixels. | |
6284 * depth: Color depth of the pixmap. | |
6285 * Returns: | |
6286 * A handle to a pixmap or NULL on failure. | |
6287 */ | |
6288 HPIXMAP dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) | |
6289 { | |
6290 BITMAPINFOHEADER bmih; | |
6291 SIZEL sizl = { 0, 0 }; | |
6292 HPIXMAP pixmap; | |
6293 HDC hdc; | |
6294 HPS hps; | |
6295 ULONG ulFlags; | |
6296 LONG cPlanes, cBitCount; | |
6297 | |
6298 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
6299 return NULL; | |
6300 | |
6301 hps = WinGetPS(handle); | |
6302 | |
6303 hdc = GpiQueryDevice(hps); | |
6304 ulFlags = GpiQueryPS(hps, &sizl); | |
6305 | |
6306 pixmap->handle = handle; | |
6307 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
6308 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
6309 | |
6310 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes); | |
6311 if (!depth) | |
6312 { | |
6313 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount); | |
6314 depth = cBitCount; | |
6315 } | |
6316 | |
6317 memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); | |
6318 bmih.cbFix = sizeof(BITMAPINFOHEADER); | |
6319 bmih.cx = (SHORT)width; | |
6320 bmih.cy = (SHORT)height; | |
6321 bmih.cPlanes = (SHORT)cPlanes; | |
6322 bmih.cBitCount = (SHORT)depth; | |
6323 | |
6324 pixmap->width = width; pixmap->height = height; | |
6325 | |
6326 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL); | |
6327 | |
6328 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
6329 | |
6330 if (depth>8) | |
6331 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL ); | |
6332 | |
6333 WinReleasePS(hps); | |
6334 | |
6335 return pixmap; | |
6336 } | |
6337 | |
6338 /* | |
6339 * Creates a pixmap from internal resource graphic specified by id. | |
6340 * Parameters: | |
6341 * handle: Window handle the pixmap is associated with. | |
6342 * id: Resource ID associated with requested pixmap. | |
6343 * Returns: | |
6344 * A handle to a pixmap or NULL on failure. | |
6345 */ | |
6346 HPIXMAP dw_pixmap_grab(HWND handle, ULONG id) | |
6347 { | |
6348 BITMAPINFOHEADER bmih; | |
6349 SIZEL sizl = { 0, 0 }; | |
6350 HPIXMAP pixmap; | |
6351 HDC hdc; | |
6352 HPS hps; | |
6353 ULONG ulFlags; | |
6354 | |
6355 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
6356 return NULL; | |
6357 | |
6358 hps = WinGetPS(handle); | |
6359 | |
6360 hdc = GpiQueryDevice(hps); | |
6361 ulFlags = GpiQueryPS(hps, &sizl); | |
6362 | |
6363 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
6364 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
6365 | |
6366 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0); | |
6367 | |
6368 GpiQueryBitmapParameters(pixmap->hbm, &bmih); | |
6369 | |
6370 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
6371 | |
6372 pixmap->width = bmih.cx; pixmap->height = bmih.cy; | |
6373 | |
6374 WinReleasePS(hps); | |
6375 | |
6376 return pixmap; | |
6377 } | |
6378 | |
6379 /* | |
6380 * Destroys an allocated pixmap. | |
6381 * Parameters: | |
6382 * pixmap: Handle to a pixmap returned by | |
6383 * dw_pixmap_new.. | |
6384 */ | |
6385 void dw_pixmap_destroy(HPIXMAP pixmap) | |
6386 { | |
6387 GpiSetBitmap(pixmap->hps, NULLHANDLE); | |
6388 GpiDeleteBitmap(pixmap->hbm); | |
6389 GpiAssociate(pixmap->hps, NULLHANDLE); | |
6390 GpiDestroyPS(pixmap->hps); | |
6391 DevCloseDC(pixmap->hdc); | |
6392 free(pixmap); | |
6393 } | |
6394 | |
6395 /* | |
6396 * Copies from one item to another. | |
6397 * Parameters: | |
6398 * dest: Destination window handle. | |
6399 * destp: Destination pixmap. (choose only one). | |
6400 * xdest: X coordinate of destination. | |
6401 * ydest: Y coordinate of destination. | |
6402 * width: Width of area to copy. | |
6403 * height: Height of area to copy. | |
6404 * src: Source window handle. | |
6405 * srcp: Source pixmap. (choose only one). | |
6406 * xsrc: X coordinate of source. | |
6407 * ysrc: Y coordinate of source. | |
6408 */ | |
6409 void dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) | |
6410 { | |
6411 HPS hpsdest; | |
6412 HPS hpssrc; | |
6413 POINTL ptl[4]; | |
6414 int destheight, srcheight; | |
6415 | |
6416 if(dest) | |
6417 { | |
6418 hpsdest = WinGetPS(dest); | |
6419 destheight = _get_height(dest); | |
6420 } | |
6421 else if(destp) | |
6422 { | |
6423 hpsdest = destp->hps; | |
6424 destheight = destp->height; | |
6425 } | |
6426 else | |
6427 return; | |
6428 | |
6429 if(src) | |
6430 { | |
6431 hpssrc = WinGetPS(src); | |
6432 srcheight = _get_height(src); | |
6433 } | |
6434 else if(srcp) | |
6435 { | |
6436 hpssrc = srcp->hps; | |
6437 srcheight = srcp->height; | |
6438 } | |
6439 else | |
6440 { | |
6441 if(!destp) | |
6442 WinReleasePS(hpsdest); | |
6443 return; | |
6444 } | |
6445 | |
6446 ptl[0].x = xdest; | |
6447 ptl[0].y = (destheight - ydest) - height; | |
6448 ptl[1].x = ptl[0].x + width; | |
6449 ptl[1].y = destheight - ydest; | |
6450 ptl[2].x = xsrc; | |
6451 ptl[2].y = srcheight - (ysrc + height); | |
6452 ptl[3].x = ptl[2].x + width; | |
6453 ptl[3].y = ptl[2].y + height; | |
6454 | |
6455 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE); | |
6456 | |
6457 if(!destp) | |
6458 WinReleasePS(hpsdest); | |
6459 if(!srcp) | |
6460 WinReleasePS(hpssrc); | |
6461 } | |
6462 | |
6463 /* | |
6464 * Emits a beep. | |
6465 * Parameters: | |
6466 * freq: Frequency. | |
6467 * dur: Duration. | |
6468 */ | |
6469 void dw_beep(int freq, int dur) | |
6470 { | |
6471 DosBeep(freq, dur); | |
6472 } | |
6473 | |
6474 /* | |
6475 * Returns the handle to an unnamed mutex semaphore. | |
6476 */ | |
6477 HMTX dw_mutex_new(void) | |
6478 { | |
6479 HMTX mutex; | |
6480 | |
6481 DosCreateMutexSem(NULL, &mutex, 0, FALSE); | |
6482 return mutex; | |
6483 } | |
6484 | |
6485 /* | |
6486 * Closes a semaphore created by dw_mutex_new(). | |
6487 * Parameters: | |
6488 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
6489 */ | |
6490 void dw_mutex_close(HMTX mutex) | |
6491 { | |
6492 DosCloseMutexSem(mutex); | |
6493 } | |
6494 | |
6495 /* | |
6496 * 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
|
6497 * 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
|
6498 * while blocking. |
3 | 6499 * Parameters: |
6500 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
6501 */ | |
6502 void dw_mutex_lock(HMTX mutex) | |
6503 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6504 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
|
6505 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6506 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
|
6507 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6508 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
|
6509 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6510 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
|
6511 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
|
6512 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6513 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6514 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
6515 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT); |
3 | 6516 } |
6517 | |
6518 /* | |
6519 * Reliquishes the access to the semaphore. | |
6520 * Parameters: | |
6521 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
6522 */ | |
6523 void dw_mutex_unlock(HMTX mutex) | |
6524 { | |
6525 DosReleaseMutexSem(mutex); | |
6526 } | |
6527 | |
6528 /* | |
6529 * Returns the handle to an unnamed event semaphore. | |
6530 */ | |
6531 HEV dw_event_new(void) | |
6532 { | |
6533 HEV blah; | |
6534 | |
6535 if(DosCreateEventSem (NULL, &blah, 0L, FALSE)) | |
6536 return 0; | |
6537 | |
6538 return blah; | |
6539 } | |
6540 | |
6541 /* | |
6542 * Resets a semaphore created by dw_event_new(). | |
6543 * Parameters: | |
6544 * eve: The handle to the event returned by dw_event_new(). | |
6545 */ | |
6546 int dw_event_reset(HEV eve) | |
6547 { | |
6548 ULONG count; | |
6549 | |
6550 if(DosResetEventSem(eve, &count)) | |
6551 return FALSE; | |
6552 return TRUE; | |
6553 } | |
6554 | |
6555 /* | |
6556 * Posts a semaphore created by dw_event_new(). Causing all threads | |
6557 * waiting on this event in dw_event_wait to continue. | |
6558 * Parameters: | |
6559 * eve: The handle to the event returned by dw_event_new(). | |
6560 */ | |
6561 int dw_event_post(HEV eve) | |
6562 { | |
6563 if(DosPostEventSem(eve)) | |
6564 return FALSE; | |
6565 return TRUE; | |
6566 } | |
6567 | |
6568 | |
6569 /* | |
6570 * Waits on a semaphore created by dw_event_new(), until the | |
6571 * event gets posted or until the timeout expires. | |
6572 * Parameters: | |
6573 * eve: The handle to the event returned by dw_event_new(). | |
6574 */ | |
6575 int dw_event_wait(HEV eve, unsigned long timeout) | |
6576 { | |
6577 int rc = DosWaitEventSem(eve, timeout); | |
6578 if(!rc) | |
6579 return 1; | |
6580 if(rc == ERROR_TIMEOUT) | |
6581 return -1; | |
6582 return 0; | |
6583 } | |
6584 | |
6585 /* | |
6586 * Closes a semaphore created by dw_event_new(). | |
6587 * Parameters: | |
6588 * eve: The handle to the event returned by dw_event_new(). | |
6589 */ | |
6590 int dw_event_close(HEV *eve) | |
6591 { | |
6592 if(!eve || ~DosCloseEventSem(*eve)) | |
6593 return FALSE; | |
6594 return TRUE; | |
6595 } | |
6596 | |
6597 /* | |
6598 * Encapsulate the message queues on OS/2. | |
6599 */ | |
6600 void _dwthreadstart(void *data) | |
6601 { | |
6602 HAB thishab = WinInitialize(0); | |
6603 HMQ thishmq = WinCreateMsgQueue(dwhab, 0); | |
6604 void (*threadfunc)(void *) = NULL; | |
6605 void **tmp = (void **)data; | |
6606 | |
6607 threadfunc = (void (*)(void *))tmp[0]; | |
6608 threadfunc(tmp[1]); | |
6609 | |
6610 free(tmp); | |
6611 | |
6612 WinDestroyMsgQueue(thishmq); | |
6613 WinTerminate(thishab); | |
6614 } | |
6615 | |
6616 /* | |
6617 * Creates a new thread with a starting point of func. | |
6618 * Parameters: | |
6619 * func: Function which will be run in the new thread. | |
6620 * data: Parameter(s) passed to the function. | |
6621 * stack: Stack size of new thread (OS/2 and Windows only). | |
6622 */ | |
6623 DWTID dw_thread_new(void *func, void *data, int stack) | |
6624 { | |
6625 void **tmp = malloc(sizeof(void *) * 2); | |
6626 | |
6627 tmp[0] = func; | |
6628 tmp[1] = data; | |
6629 | |
6630 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp); | |
6631 } | |
6632 | |
6633 /* | |
6634 * Ends execution of current thread immediately. | |
6635 */ | |
6636 void dw_thread_end(void) | |
6637 { | |
6638 _endthread(); | |
6639 } | |
6640 | |
6641 /* | |
6642 * Returns the current thread's ID. | |
6643 */ | |
6644 DWTID dw_thread_id(void) | |
6645 { | |
6646 return (DWTID)_threadid; | |
6647 } | |
6648 | |
6649 /* | |
6650 * Cleanly terminates a DW session, should be signal handler safe. | |
6651 * Parameters: | |
6652 * exitcode: Exit code reported to the operating system. | |
6653 */ | |
6654 void dw_exit(int exitcode) | |
6655 { | |
6656 /* In case we are in a signal handler, don't | |
6657 * try to free memory that could possibly be | |
6658 * free()'d by the runtime already. | |
6659 */ | |
6660 #ifndef NO_SIGNALS | |
6661 Root = NULL; | |
6662 #endif | |
6663 exit(exitcode); | |
6664 } | |
6665 | |
6666 /* | |
6667 * Pack a splitbar (sizer) into the specified box from the start. | |
6668 * Parameters: | |
6669 * box: Window handle of the box to be packed into. | |
6670 */ | |
6671 void dw_box_pack_splitbar_start(HWND box) | |
6672 { | |
6673 Box *thisbox; | |
6674 | |
6675 if(WinWindowFromID(box, FID_CLIENT)) | |
6676 { | |
6677 box = WinWindowFromID(box, FID_CLIENT); | |
6678 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6679 } | |
6680 else | |
6681 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6682 if(thisbox) | |
6683 { | |
6684 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
6685 SplitbarClassName, | |
6686 NULL, | |
6687 WS_VISIBLE, | |
6688 0,0,2000,1000, | |
6689 NULLHANDLE, | |
6690 HWND_TOP, | |
6691 0L, | |
6692 NULL, | |
6693 NULL); | |
6694 if(thisbox->type == BOXVERT) | |
6695 dw_box_pack_start(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0); | |
6696 else | |
6697 dw_box_pack_start(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0); | |
6698 | |
6699 } | |
6700 } | |
6701 | |
6702 /* | |
6703 * Pack a splitbar (sizer) into the specified box from the end. | |
6704 * Parameters: | |
6705 * box: Window handle of the box to be packed into. | |
6706 */ | |
6707 void dw_box_pack_splitbar_end(HWND box) | |
6708 { | |
6709 Box *thisbox; | |
6710 | |
6711 if(WinWindowFromID(box, FID_CLIENT)) | |
6712 { | |
6713 box = WinWindowFromID(box, FID_CLIENT); | |
6714 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6715 } | |
6716 else | |
6717 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6718 if(thisbox) | |
6719 { | |
6720 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
6721 SplitbarClassName, | |
6722 NULL, | |
6723 WS_VISIBLE, | |
6724 0,0,2000,1000, | |
6725 NULLHANDLE, | |
6726 HWND_TOP, | |
6727 0L, | |
6728 NULL, | |
6729 NULL); | |
6730 if(thisbox->type == BOXVERT) | |
6731 dw_box_pack_end(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0); | |
6732 else | |
6733 dw_box_pack_end(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0); | |
6734 | |
6735 } | |
6736 } | |
6737 | |
6738 /* | |
6739 * Pack windows (widgets) into a box from the start (or top). | |
6740 * Parameters: | |
6741 * box: Window handle of the box to be packed into. | |
6742 * item: Window handle of the item to be back. | |
6743 * width: Width in pixels of the item or -1 to be self determined. | |
6744 * height: Height in pixels of the item or -1 to be self determined. | |
6745 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
6746 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
6747 * pad: Number of pixels of padding around the item. | |
6748 */ | |
6749 void dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
6750 { | |
6751 Box *thisbox; | |
6752 | |
6753 if(WinWindowFromID(box, FID_CLIENT)) | |
6754 { | |
6755 box = WinWindowFromID(box, FID_CLIENT); | |
6756 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6757 } | |
6758 else | |
6759 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6760 if(thisbox) | |
6761 { | |
6762 if(thisbox->type == BOXHORZ) | |
6763 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); | |
6764 else | |
6765 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); | |
6766 } | |
6767 } | |
6768 | |
6769 void dw_box_pack_start_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | |
6770 { | |
6771 Box *thisbox; | |
6772 | |
6773 if(WinWindowFromID(box, FID_CLIENT)) | |
6774 { | |
6775 box = WinWindowFromID(box, FID_CLIENT); | |
6776 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6777 hsize = TRUE; | |
6778 vsize = TRUE; | |
6779 } | |
6780 else | |
6781 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
6782 if(thisbox) | |
6783 { | |
6784 int z; | |
6785 Item *tmpitem, *thisitem = thisbox->items; | |
6786 char tmpbuf[100]; | |
6787 | |
6788 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
6789 | |
6790 for(z=0;z<thisbox->count;z++) | |
6791 { | |
6792 tmpitem[z+1] = thisitem[z]; | |
6793 } | |
6794 | |
6795 WinQueryClassName(item, 99, tmpbuf); | |
6796 | |
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
|
6797 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 6798 tmpitem[0].type = TYPEBOX; |
6799 else | |
6800 tmpitem[0].type = TYPEITEM; | |
6801 | |
6802 tmpitem[0].hwnd = item; | |
6803 tmpitem[0].origwidth = tmpitem[0].width = width; | |
6804 tmpitem[0].origheight = tmpitem[0].height = height; | |
6805 tmpitem[0].pad = pad; | |
6806 if(hsize) | |
6807 tmpitem[0].hsize = SIZEEXPAND; | |
6808 else | |
6809 tmpitem[0].hsize = SIZESTATIC; | |
6810 | |
6811 if(vsize) | |
6812 tmpitem[0].vsize = SIZEEXPAND; | |
6813 else | |
6814 tmpitem[0].vsize = SIZESTATIC; | |
6815 | |
6816 thisbox->items = tmpitem; | |
6817 | |
6818 if(thisbox->count) | |
6819 free(thisitem); | |
6820 | |
6821 thisbox->count++; | |
6822 | |
6823 WinQueryClassName(item, 99, tmpbuf); | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
6824 /* 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
|
6825 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
|
6826 WinSetOwner(item, box); |
3 | 6827 WinSetParent(item, box, FALSE); |
6828 } | |
6829 } | |
6830 | |
6831 /* The following two functions graciously contributed by Peter Nielsen. */ | |
6832 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) { | |
6833 char* pchStart = pchBuffer; | |
6834 char* pchEnd = pchStart + ulSize - 2; | |
6835 | |
6836 while (pchEnd >= pchStart) | |
6837 { | |
6838 if ((pchEnd[0] == '#') && (pchEnd[1] == '@')) | |
6839 { | |
6840 *pchEnd-- = '\0'; | |
6841 while (pchEnd >= pchStart) | |
6842 { | |
6843 if ((pchEnd[0] == '@') && (pchEnd[1] == '#')) | |
6844 { | |
6845 ULONG ulMajor = 0; | |
6846 ULONG ulMinor = 0; | |
6847 | |
6848 char* pch = pchEnd + 2; | |
6849 while (!isdigit (*pch) && *pch) | |
6850 pch++; | |
6851 | |
6852 while (isdigit (*pch)) | |
6853 ulMajor = ulMajor * 10 + *pch++ - '0'; | |
6854 | |
6855 if (*pch == '.') | |
6856 { | |
6857 while (isdigit (*++pch)) | |
6858 ulMinor = ulMinor * 10 + *pch - '0'; | |
6859 } | |
6860 return ((ulMajor << 16) | ulMinor); | |
6861 } | |
6862 pchEnd--; | |
6863 } | |
6864 } | |
6865 pchEnd--; | |
6866 } | |
6867 return (0); | |
6868 } | |
6869 | |
6870 ULONG _GetSystemBuildLevel(void) { | |
6871 /* 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. | |
6872 * 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. | |
6873 */ | |
6874 ULONG ulBootDrive = 0; | |
6875 ULONG ulBuild = 0; | |
6876 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR) | |
6877 { | |
6878 char achFileName[11] = { (char)('A'+ulBootDrive-1),':','\\','O','S','2','K','R','N','L','\0' }; | |
6879 HFILE hfile; | |
6880 ULONG ulResult; | |
6881 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) | |
6882 { | |
6883 ULONG ulFileSize = 0; | |
6884 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR) | |
6885 { | |
6886 const ULONG ulFirstTry = min (256, ulFileSize); | |
6887 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR) | |
6888 { | |
6889 char *pchBuffer = malloc(ulFirstTry); | |
6890 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR) | |
6891 { | |
6892 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry); | |
6893 if (ulBuild == 0) | |
6894 { | |
6895 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR) | |
6896 { | |
6897 free(pchBuffer); | |
6898 pchBuffer = malloc(ulFileSize); | |
6899 | |
6900 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR) | |
6901 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize); | |
6902 } | |
6903 } | |
6904 } | |
6905 free(pchBuffer); | |
6906 } | |
6907 } | |
6908 DosClose (hfile); | |
6909 } | |
6910 } | |
6911 return (ulBuild); | |
6912 } | |
6913 | |
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
|
6914 /* |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6915 * 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
|
6916 * 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
|
6917 * 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
|
6918 * 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
|
6919 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6920 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
|
6921 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6922 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
|
6923 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
|
6924 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6925 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
|
6926 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
|
6927 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
|
6928 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6929 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
|
6930 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
|
6931 } |
3 | 6932 |
6933 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6934 * 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
|
6935 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6936 * 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
|
6937 * 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
|
6938 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6939 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
|
6940 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6941 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
6942 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
6943 if(blah) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6944 blah->clickdefault = next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6945 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6946 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
6947 /* |
3 | 6948 * Returns some information about the current operating environment. |
6949 * Parameters: | |
6950 * env: Pointer to a DWEnv struct. | |
6951 */ | |
6952 void dw_environment_query(DWEnv *env) | |
6953 { | |
6954 ULONG Build; | |
6955 | |
6956 if(!env) | |
6957 return; | |
6958 | |
6959 /* The default is OS/2 2.0 */ | |
6960 strcpy(env->osName,"OS/2"); | |
6961 env->MajorVersion = 2; | |
6962 env->MinorVersion = 0; | |
6963 | |
6964 Build = _GetSystemBuildLevel(); | |
6965 env->MinorBuild = Build & 0xFFFF; | |
6966 env->MajorBuild = Build >> 16; | |
6967 | |
6968 if (aulBuffer[0] == 20) | |
6969 { | |
6970 int i = (unsigned int)aulBuffer[1]; | |
6971 if (i > 20) | |
6972 { | |
6973 strcpy(env->osName,"Warp"); | |
6974 env->MajorVersion = (int)i/10; | |
6975 env->MinorVersion = i-(((int)i/10)*10); | |
6976 } | |
6977 else if (i == 10) | |
6978 env->MinorVersion = 1; | |
6979 } | |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
6980 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
|
6981 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
|
6982 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
|
6983 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
|
6984 env->DWSubVersion = DW_SUB_VERSION; |
3 | 6985 } |
6986 | |
6987 /* | |
6988 * Opens a file dialog and queries user selection. | |
6989 * Parameters: | |
6990 * title: Title bar text for dialog. | |
6991 * defpath: The default path of the open dialog. | |
6992 * ext: Default file extention. | |
6993 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
6994 * Returns: | |
6995 * NULL on error. A malloced buffer containing | |
6996 * the file path on success. | |
6997 * | |
6998 */ | |
6999 char *dw_file_browse(char *title, char *defpath, char *ext, int flags) | |
7000 { | |
7001 FILEDLG fild; | |
7002 HWND hwndFile; | |
7003 int len; | |
7004 | |
7005 if(defpath) | |
7006 strcpy(fild.szFullFile, defpath); | |
7007 else | |
7008 strcpy(fild.szFullFile, ""); | |
7009 | |
7010 len = strlen(fild.szFullFile); | |
7011 | |
7012 if(len) | |
7013 { | |
7014 if(fild.szFullFile[len-1] != '\\') | |
7015 strcat(fild.szFullFile, "\\"); | |
7016 } | |
7017 strcat(fild.szFullFile, "*"); | |
7018 | |
7019 if(ext) | |
7020 { | |
7021 strcat(fild.szFullFile, "."); | |
7022 strcat(fild.szFullFile, ext); | |
7023 } | |
7024 | |
7025 fild.cbSize = sizeof(FILEDLG); | |
7026 fild.fl = /*FDS_HELPBUTTON |*/ FDS_CENTER | FDS_OPEN_DIALOG; | |
7027 fild.pszTitle = title; | |
7028 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open"); | |
7029 fild.ulUser = 0L; | |
7030 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc; | |
7031 fild.lReturn = 0L; | |
7032 fild.lSRC = 0L; | |
7033 fild.hMod = 0; | |
7034 fild.x = 0; | |
7035 fild.y = 0; | |
7036 fild.pszIType = (PSZ)NULL; | |
7037 fild.papszITypeList = (PAPSZ)NULL; | |
7038 fild.pszIDrive = (PSZ)NULL; | |
7039 fild.papszIDriveList= (PAPSZ)NULL; | |
7040 fild.sEAType = (SHORT)0; | |
7041 fild.papszFQFilename= (PAPSZ)NULL; | |
7042 fild.ulFQFCount = 0L; | |
7043 | |
7044 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild); | |
7045 if(hwndFile) | |
7046 { | |
7047 switch(fild.lReturn) | |
7048 { | |
7049 case DID_OK: | |
7050 return strdup(fild.szFullFile); | |
7051 case DID_CANCEL: | |
7052 return NULL; | |
7053 } | |
7054 } | |
7055 return NULL; | |
7056 } | |
7057 | |
7058 /* | |
7059 * Execute and external program in a seperate session. | |
7060 * Parameters: | |
7061 * program: Program name with optional path. | |
7062 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
7063 * params: An array of pointers to string arguements. | |
7064 * Returns: | |
7065 * -1 on error. | |
7066 */ | |
7067 int dw_exec(char *program, int type, char **params) | |
7068 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7069 return spawnvp(P_NOWAIT, program, (const char **)params); |
3 | 7070 } |
7071 | |
7072 /* | |
7073 * Loads a web browser pointed at the given URL. | |
7074 * Parameters: | |
7075 * url: Uniform resource locator. | |
7076 */ | |
7077 int dw_browse(char *url) | |
7078 { | |
7079 /* 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
|
7080 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
|
7081 int len; |
3 | 7082 |
7083 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", | |
7084 "DefaultBrowserExe", NULL, browser, 1024); | |
7085 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7086 len = strlen(browser) - strlen("explore.exe"); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7087 |
3 | 7088 execargs[0] = browser; |
7089 execargs[1] = url; | |
7090 execargs[2] = NULL; | |
7091 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7092 /* 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
|
7093 * 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
|
7094 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7095 if(len > 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7096 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7097 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
|
7098 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7099 int newlen, z; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7100 newurl = alloca(strlen(url) + 2); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7101 sprintf(newurl, "file:///%s", &url[7]); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7102 newlen = strlen(newurl); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7103 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
|
7104 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7105 if(newurl[z] == '|') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7106 newurl[z] = ':'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7107 if(newurl[z] == '/') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7108 newurl[z] = '\\'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7109 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7110 execargs[1] = newurl; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7111 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7112 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
7113 |
3 | 7114 return dw_exec(browser, DW_EXEC_GUI, execargs); |
7115 } | |
7116 | |
7117 /* | |
7118 * Returns a pointer to a static buffer which containes the | |
7119 * current user directory. Or the root directory (C:\ on | |
7120 * OS/2 and Windows). | |
7121 */ | |
7122 char *dw_user_dir(void) | |
7123 { | |
7124 static char _user_dir[1024] = ""; | |
7125 | |
7126 if(!_user_dir[0]) | |
7127 { | |
7128 char *home = getenv("HOME"); | |
7129 | |
7130 if(home) | |
7131 strcpy(_user_dir, home); | |
7132 else | |
7133 strcpy(_user_dir, "C:\\"); | |
7134 } | |
7135 return _user_dir; | |
7136 } | |
7137 | |
7138 /* | |
7139 * Call a function from the window (widget)'s context. | |
7140 * Parameters: | |
7141 * handle: Window handle of the widget. | |
7142 * function: Function pointer to be called. | |
7143 * data: Pointer to the data to be passed to the function. | |
7144 */ | |
7145 void dw_window_function(HWND handle, void *function, void *data) | |
7146 { | |
7147 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data); | |
7148 } | |
7149 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7150 /* 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
|
7151 * 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
|
7152 * 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
|
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 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
|
7155 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7156 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
|
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 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
|
7159 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7160 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
|
7161 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
|
7162 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
|
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 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
|
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 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
|
7168 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7169 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
|
7170 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7171 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
|
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 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
|
7174 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
|
7175 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7176 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7177 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7178 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
|
7179 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
|
7180 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7181 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
|
7182 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
|
7183 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7184 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
|
7185 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7186 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
|
7187 *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
|
7188 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7189 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7190 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
|
7191 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
|
7192 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7193 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
|
7194 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
|
7195 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7196 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
|
7197 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
|
7198 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7199 *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
|
7200 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7201 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
|
7202 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7203 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7204 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
|
7205 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7206 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7207 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
|
7208 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7209 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
|
7210 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7211 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
|
7212 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7213 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
|
7214 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7215 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
|
7216 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7217 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
|
7218 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
|
7219 *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
|
7220 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
|
7221 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7222 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7223 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7224 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
|
7225 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
|
7226 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
|
7227 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
|
7228 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7229 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7230 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
|
7231 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7232 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
|
7233 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7234 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7235 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7236 * 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
|
7237 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7238 * 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
|
7239 * 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
|
7240 * 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
|
7241 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7242 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
|
7243 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7244 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
|
7245 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7246 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
|
7247 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7248 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
|
7249 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
|
7250 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7251 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7252 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
|
7253 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
|
7254 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7255 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
|
7256 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7257 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7258 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7259 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7260 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7261 * 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
|
7262 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7263 * 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
|
7264 * 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
|
7265 * 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
|
7266 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7267 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
|
7268 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7269 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
|
7270 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7271 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
|
7272 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7273 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
|
7274 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
|
7275 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
|
7276 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7277 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
|
7278 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
7279 |
3 | 7280 #ifndef NO_SIGNALS |
7281 /* | |
7282 * Add a callback to a window event. | |
7283 * Parameters: | |
7284 * window: Window handle of signal to be called back. | |
7285 * signame: A string pointer identifying which signal to be hooked. | |
7286 * sigfunc: The pointer to the function to be used as the callback. | |
7287 * data: User data to be passed to the handler function. | |
7288 */ | |
7289 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) | |
7290 { | |
7291 ULONG message = 0L; | |
7292 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7293 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
|
7294 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7295 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
|
7296 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7297 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
|
7298 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7299 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
|
7300 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7301 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
|
7302 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
|
7303 WinEndEnumWindows(henum); |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7304 if(child) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7305 window = child; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7306 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
7307 } |
3 | 7308 if(window && signame && sigfunc) |
7309 { | |
7310 if((message = _findsigmessage(signame)) != 0) | |
7311 _new_signal(message, window, sigfunc, data); | |
7312 } | |
7313 } | |
7314 | |
7315 /* | |
7316 * Removes callbacks for a given window with given name. | |
7317 * Parameters: | |
7318 * window: Window handle of callback to be removed. | |
7319 */ | |
7320 void dw_signal_disconnect_by_name(HWND window, char *signame) | |
7321 { | |
7322 SignalHandler *prev = NULL, *tmp = Root; | |
7323 ULONG message; | |
7324 | |
7325 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | |
7326 return; | |
7327 | |
7328 while(tmp) | |
7329 { | |
7330 if(tmp->window == window && tmp->message == message) | |
7331 { | |
7332 if(prev) | |
7333 { | |
7334 prev->next = tmp->next; | |
7335 free(tmp); | |
7336 tmp = prev->next; | |
7337 } | |
7338 else | |
7339 { | |
7340 Root = tmp->next; | |
7341 free(tmp); | |
7342 tmp = Root; | |
7343 } | |
7344 } | |
7345 else | |
7346 { | |
7347 prev = tmp; | |
7348 tmp = tmp->next; | |
7349 } | |
7350 } | |
7351 } | |
7352 | |
7353 /* | |
7354 * Removes all callbacks for a given window. | |
7355 * Parameters: | |
7356 * window: Window handle of callback to be removed. | |
7357 */ | |
7358 void dw_signal_disconnect_by_window(HWND window) | |
7359 { | |
7360 SignalHandler *prev = NULL, *tmp = Root; | |
7361 | |
7362 while(tmp) | |
7363 { | |
7364 if(tmp->window == window) | |
7365 { | |
7366 if(prev) | |
7367 { | |
7368 prev->next = tmp->next; | |
7369 free(tmp); | |
7370 tmp = prev->next; | |
7371 } | |
7372 else | |
7373 { | |
7374 Root = tmp->next; | |
7375 free(tmp); | |
7376 tmp = Root; | |
7377 } | |
7378 } | |
7379 else | |
7380 { | |
7381 prev = tmp; | |
7382 tmp = tmp->next; | |
7383 } | |
7384 } | |
7385 } | |
7386 | |
7387 /* | |
7388 * Removes all callbacks for a given window with specified data. | |
7389 * Parameters: | |
7390 * window: Window handle of callback to be removed. | |
7391 * data: Pointer to the data to be compared against. | |
7392 */ | |
7393 void dw_signal_disconnect_by_data(HWND window, void *data) | |
7394 { | |
7395 SignalHandler *prev = NULL, *tmp = Root; | |
7396 | |
7397 while(tmp) | |
7398 { | |
7399 if(tmp->window == window && tmp->data == data) | |
7400 { | |
7401 if(prev) | |
7402 { | |
7403 prev->next = tmp->next; | |
7404 free(tmp); | |
7405 tmp = prev->next; | |
7406 } | |
7407 else | |
7408 { | |
7409 Root = tmp->next; | |
7410 free(tmp); | |
7411 tmp = Root; | |
7412 } | |
7413 } | |
7414 else | |
7415 { | |
7416 prev = tmp; | |
7417 tmp = tmp->next; | |
7418 } | |
7419 } | |
7420 } | |
7421 #endif | |
7422 | |
7423 #ifdef TEST | |
7424 HWND mainwindow, | |
7425 listbox, | |
7426 okbutton, | |
7427 cancelbutton, | |
7428 lbbox, | |
7429 stext, | |
7430 buttonbox, | |
7431 testwindow, | |
7432 testbox, | |
7433 testok, | |
7434 testcancel, | |
7435 testbox2, | |
7436 testok2, | |
7437 testcancel2, | |
7438 notebook; | |
7439 int count = 2; | |
7440 | |
7441 #ifdef USE_FILTER | |
7442 /* Do any handling you need in the filter function */ | |
7443 LONG testfilter(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
7444 { | |
7445 switch(msg) | |
7446 { | |
7447 case WM_COMMAND: | |
7448 switch (COMMANDMSG(&msg)->cmd) | |
7449 { | |
7450 case 1001L: | |
7451 case 1002L: | |
7452 dw_window_destroy(mainwindow);; | |
7453 count--; | |
7454 break; | |
7455 case 1003L: | |
7456 case 1004L: | |
7457 dw_window_destroy(testwindow);; | |
7458 count--; | |
7459 break; | |
7460 } | |
7461 if(!count) | |
7462 exit(0); | |
7463 break; | |
7464 } | |
7465 /* Return -1 to allow the default handlers to return. */ | |
7466 return TRUE; | |
7467 } | |
7468 #else | |
7469 int test_callback(HWND window, void *data) | |
7470 { | |
7471 dw_window_destroy((HWND)data); | |
7472 /* Return -1 to allow the default handlers to return. */ | |
7473 count--; | |
7474 if(!count) | |
7475 exit(0); | |
7476 return -1; | |
7477 } | |
7478 #endif | |
7479 | |
7480 /* | |
7481 * Let's demonstrate the functionality of this library. :) | |
7482 */ | |
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
|
7483 int main(int argc, char *argv[]) |
3 | 7484 { |
7485 ULONG flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | | |
7486 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; | |
7487 int pageid; | |
7488 | |
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
|
7489 dw_init(TRUE, argc, argv); |
3 | 7490 |
7491 /* Try a little server dialog. :) */ | |
7492 mainwindow = dw_window_new(HWND_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); | |
7493 | |
7494 lbbox = dw_box_new(BOXVERT, 10); | |
7495 | |
7496 dw_box_pack_start(mainwindow, lbbox, 0, 0, TRUE, TRUE, 0); | |
7497 | |
7498 stext = dw_text_new("Choose a server:", 0); | |
7499 | |
7500 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); | |
7501 | |
7502 dw_box_pack_start(lbbox, stext, 130, 15, FALSE, FALSE, 10); | |
7503 | |
7504 listbox = dw_listbox_new(100L, FALSE); | |
7505 | |
7506 dw_box_pack_start(lbbox, listbox, 130, 200, TRUE, TRUE, 10); | |
7507 | |
7508 buttonbox = dw_box_new(BOXHORZ, 0); | |
7509 | |
7510 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); | |
7511 | |
7512 okbutton = dw_button_new("Ok", 1001L); | |
7513 | |
7514 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, TRUE, 5); | |
7515 | |
7516 cancelbutton = dw_button_new("Cancel", 1002L); | |
7517 | |
7518 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, TRUE, 5); | |
7519 | |
7520 /* Set some nice fonts and colors */ | |
7521 dw_window_set_color(lbbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7522 dw_window_set_color(buttonbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7523 dw_window_set_font(stext, "9.WarpSans"); | |
7524 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
7525 dw_window_set_font(listbox, "9.WarpSans"); | |
7526 dw_window_set_font(okbutton, "9.WarpSans"); | |
7527 dw_window_set_font(cancelbutton, "9.WarpSans"); | |
7528 | |
7529 dw_window_show(mainwindow); | |
7530 | |
7531 dw_window_set_usize(mainwindow, 170, 340); | |
7532 | |
7533 /* Another small example */ | |
7534 flStyle |= FCF_MINMAX | FCF_SIZEBORDER; | |
7535 | |
7536 testwindow = dw_window_new(HWND_DESKTOP, "Wow a test dialog! :) yay!", flStyle); | |
7537 | |
7538 testbox = dw_box_new(BOXVERT, 0); | |
7539 | |
7540 dw_box_pack_start(testwindow, testbox, 0, 0, TRUE, TRUE, 0); | |
7541 | |
7542 notebook = dw_notebook_new(1010L, TRUE); | |
7543 | |
7544 dw_box_pack_start(testbox, notebook, 100, 100, TRUE, TRUE, 0); | |
7545 | |
7546 testbox = dw_box_new(BOXVERT, 10); | |
7547 | |
7548 pageid = dw_notebook_page_new(notebook, 0L, FALSE); | |
7549 | |
7550 dw_notebook_page_set_text(notebook, pageid, "Test page"); | |
7551 dw_notebook_page_set_status_text(notebook, pageid, "Test page"); | |
7552 | |
7553 dw_notebook_pack(notebook, pageid, testbox); | |
7554 | |
7555 testok = dw_button_new("Ok", 1003L); | |
7556 | |
7557 dw_box_pack_start(testbox, testok, 60, 40, TRUE, TRUE, 10); | |
7558 | |
7559 testcancel = dw_button_new("Cancel", 1004L); | |
7560 | |
7561 dw_box_pack_start(testbox, testcancel, 60, 40, TRUE, TRUE, 10); | |
7562 | |
7563 testbox2 = dw_box_new(BOXHORZ, 0); | |
7564 | |
7565 dw_box_pack_start(testbox, testbox2, 0, 0, TRUE, TRUE, 0); | |
7566 | |
7567 testok2 = dw_button_new("Ok", 1003L); | |
7568 | |
7569 dw_box_pack_start(testbox2, testok2, 60, 40, TRUE, TRUE, 10); | |
7570 | |
7571 dw_box_pack_splitbar_start(testbox2); | |
7572 | |
7573 testcancel2 = dw_button_new("Cancel", 1004L); | |
7574 | |
7575 dw_box_pack_start(testbox2, testcancel2, 60, 40, TRUE, TRUE, 10); | |
7576 | |
7577 /* Set some nice fonts and colors */ | |
7578 dw_window_set_color(testbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7579 dw_window_set_color(testbox2, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
7580 dw_window_set_font(testok, "9.WarpSans"); | |
7581 dw_window_set_font(testcancel, "9.WarpSans"); | |
7582 dw_window_set_font(testok2, "9.WarpSans"); | |
7583 dw_window_set_font(testcancel2, "9.WarpSans"); | |
7584 | |
7585 dw_window_show(testwindow); | |
7586 | |
7587 #ifdef USE_FILTER | |
7588 dw_main(0L, (void *)testfilter); | |
7589 #else | |
7590 /* Setup the function callbacks */ | |
7591 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7592 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7593 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7594 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7595 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7596 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7597 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); | |
7598 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); | |
7599 | |
7600 dw_main(0L, NULL); | |
7601 #endif | |
7602 | |
7603 return 0; | |
7604 } | |
7605 #endif |