Mercurial > dwindows
annotate os2/dw.c @ 457:e6b00c3e5086
Merging layout engine fix from the windows code.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 25 Jun 2003 04:43:33 +0000 |
parents | f1f188c678f3 |
children | 768f3546c4b5 |
rev | line source |
---|---|
3 | 1 /* |
2 * Dynamic Windows: | |
3 * A GTK like implementation of the PM GUI | |
4 * | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
5 * (C) 2000-2003 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> |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
25 #include <io.h> |
171
b8e93557b2c7
EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
170
diff
changeset
|
26 #ifndef __EMX__ |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
27 #include <direct.h> |
171
b8e93557b2c7
EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
170
diff
changeset
|
28 #endif |
3 | 29 #include "dw.h" |
30 | |
31 #define QWP_USER 0 | |
32 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
33 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
|
34 void _do_resize(Box *thisbox, int x, int y); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
35 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
36 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height); |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
37 void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname); |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
38 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
39 |
3 | 40 char ClassName[] = "dynamicwindows"; |
41 char SplitbarClassName[] = "dwsplitbar"; | |
360
cf66410d03b4
Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
356
diff
changeset
|
42 char *DefaultFont = "9.WarpSans"; |
3 | 43 |
44 HAB dwhab = 0; | |
45 HMQ dwhmq = 0; | |
46 DWTID _dwtid = 0; | |
369
39983df2b93d
Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
368
diff
changeset
|
47 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT; |
3 | 48 |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
49 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
50 PRECORDCORE pCore = NULL, pCoreEmph = NULL; |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
51 ULONG aulBuffer[4]; |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
52 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
53 |
224
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
54 unsigned long _colors[] = { |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
55 CLR_BLACK, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
56 CLR_DARKRED, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
57 CLR_DARKGREEN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
58 CLR_BROWN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
59 CLR_DARKBLUE, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
60 CLR_DARKPINK, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
61 CLR_DARKCYAN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
62 CLR_PALEGRAY, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
63 CLR_DARKGRAY, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
64 CLR_RED, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
65 CLR_GREEN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
66 CLR_YELLOW, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
67 CLR_BLUE, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
68 CLR_PINK, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
69 CLR_CYAN, |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
70 CLR_WHITE |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
71 }; |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
72 |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
73 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) |
3 | 74 |
75 #ifndef min | |
76 #define min(a, b) (((a < b) ? a : b)) | |
77 #endif | |
78 | |
79 typedef struct _sighandler | |
80 { | |
81 struct _sighandler *next; | |
82 ULONG message; | |
83 HWND window; | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
84 int id; |
3 | 85 void *signalfunction; |
86 void *data; | |
87 | |
88 } SignalHandler; | |
89 | |
90 SignalHandler *Root = NULL; | |
91 | |
92 typedef struct | |
93 { | |
94 ULONG message; | |
95 char name[30]; | |
96 | |
97 } SignalList; | |
98 | |
99 /* List of signals and their equivilent OS/2 message */ | |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
100 #define SIGNALMAX 15 |
3 | 101 |
102 SignalList SignalTranslate[SIGNALMAX] = { | |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
103 { WM_SIZE, DW_SIGNAL_CONFIGURE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
104 { WM_CHAR, DW_SIGNAL_KEY_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
105 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
106 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
107 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
108 { WM_CLOSE, DW_SIGNAL_DELETE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
109 { WM_PAINT, DW_SIGNAL_EXPOSE }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
110 { WM_COMMAND, DW_SIGNAL_CLICKED }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
111 { CN_ENTER, DW_SIGNAL_ITEM_ENTER }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
112 { CN_CONTEXTMENU, DW_SIGNAL_ITEM_CONTEXT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
113 { LN_SELECT, DW_SIGNAL_LIST_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
114 { CN_EMPHASIS, DW_SIGNAL_ITEM_SELECT }, |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
115 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS }, |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
116 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED }, |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
117 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE } |
3 | 118 }; |
119 | |
120 /* This function adds a signal handler callback into the linked list. | |
121 */ | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
122 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data) |
3 | 123 { |
124 SignalHandler *new = malloc(sizeof(SignalHandler)); | |
125 | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
126 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
|
127 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
|
128 |
3 | 129 new->message = message; |
130 new->window = window; | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
131 new->id = id; |
3 | 132 new->signalfunction = signalfunction; |
133 new->data = data; | |
134 new->next = NULL; | |
135 | |
136 if (!Root) | |
137 Root = new; | |
138 else | |
139 { | |
140 SignalHandler *prev = NULL, *tmp = Root; | |
141 while(tmp) | |
142 { | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
143 if(tmp->message == message && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
144 tmp->window == window && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
145 tmp->signalfunction == signalfunction) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
146 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
147 tmp->data = data; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
148 free(new); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
149 return; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
150 } |
3 | 151 prev = tmp; |
152 tmp = tmp->next; | |
153 } | |
154 if(prev) | |
155 prev->next = new; | |
156 else | |
157 Root = new; | |
158 } | |
159 } | |
160 | |
161 /* Finds the message number for a given signal name */ | |
162 ULONG _findsigmessage(char *signame) | |
163 { | |
164 int z; | |
165 | |
166 for(z=0;z<SIGNALMAX;z++) | |
167 { | |
168 if(stricmp(signame, SignalTranslate[z].name) == 0) | |
169 return SignalTranslate[z].message; | |
170 } | |
171 return 0L; | |
172 } | |
173 | |
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
|
174 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
|
175 { |
c4e1139d9872
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 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
|
177 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
|
178 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
|
179 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
180 } 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
|
181 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
182 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
183 int _null_key(HWND window, int key, void *data) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
184 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
185 return TRUE; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
186 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
187 |
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
|
188 /* 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
|
189 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
|
190 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
191 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
|
192 |
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 /* Find the toplevel window */ |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
194 while((box = WinQueryWindow(lastbox, QW_PARENT)) != desktop && box > 0) |
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
|
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 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
|
197 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
198 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
|
199 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
|
200 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
|
201 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
202 |
300
4559a2fd2db2
Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
203 |
156 | 204 /* Return the entryfield child of a window */ |
205 HWND _find_entryfield(HWND handle) | |
206 { | |
207 HENUM henum; | |
208 HWND child, entry = 0; | |
209 | |
210 henum = WinBeginEnumWindows(handle); | |
211 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
212 { | |
213 char tmpbuf[100]; | |
214 | |
215 WinQueryClassName(child, 99, tmpbuf); | |
216 | |
217 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */ | |
218 { | |
219 entry = child; | |
220 break; | |
221 } | |
222 } | |
223 WinEndEnumWindows(henum); | |
224 return entry; | |
225 } | |
226 | |
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
|
227 /* 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
|
228 * 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
|
229 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
230 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
|
231 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
232 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
|
233 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
|
234 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
235 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
|
236 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
|
237 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
238 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
|
239 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
240 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
|
241 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 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
|
246 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
247 _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
|
248 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
249 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
|
250 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
|
251 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
252 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
253 /* Free bitmap data associated with a window */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
254 void _free_bitmap(HWND handle) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
255 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
256 HBITMAP hbm = (HBITMAP)dw_window_get_data(handle, "_dw_bitmap"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
257 HPS hps = (HPS)dw_window_get_data(handle, "_dw_hps"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
258 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc"); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
259 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
260 HPIXMAP disable = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled"); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
261 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
262 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
263 dw_pixmap_destroy(pixmap); |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
264 |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
265 if(disable) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
266 dw_pixmap_destroy(disable); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
267 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
268 if(hps) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
269 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
270 GpiSetBitmap(hps, NULLHANDLE); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
271 GpiAssociate(hps, NULLHANDLE); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
272 GpiDestroyPS(hps); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
273 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
274 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
275 if(hdc) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
276 DevCloseDC(hdc); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
277 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
278 if(hbm) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
279 GpiDeleteBitmap(hbm); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
280 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
281 |
3 | 282 /* This function removes and handlers on windows and frees |
283 * the user memory allocated to it. | |
284 */ | |
285 void _free_window_memory(HWND handle) | |
286 { | |
287 HENUM henum; | |
288 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
|
289 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); |
3 | 290 |
291 dw_signal_disconnect_by_window(handle); | |
292 | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
293 if((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
294 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
295 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
296 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
297 if(box) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
298 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
299 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
300 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
301 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
302 WinSetWindowPtr(child, QWP_USER, 0); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
303 free(box); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
304 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
305 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
306 |
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
|
307 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
|
308 { |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
309 WindowData *wd = (WindowData *)ptr; |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
310 char tmpbuf[100]; |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
311 |
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
312 /* If this window has an associate bitmap destroy it. */ |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
313 _free_bitmap(handle); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
314 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
315 WinQueryClassName(handle, 99, tmpbuf); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
316 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
317 if(strncmp(tmpbuf, "#1", 3)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
318 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
319 Box *box = (Box *)ptr; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
320 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
321 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
322 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
323 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
324 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
325 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
326 void *data = dw_window_get_data(handle, "_dw_percent"); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
327 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
328 if(data) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
329 free(data); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
330 } |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
331 else if(strncmp(tmpbuf, "#37", 4)==0) |
342
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
332 { |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
333 dw_container_clear(handle, FALSE); |
342
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
334 if(wd && dw_window_get_data(handle, "_dw_container")) |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
335 { |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
336 void *oldflags = wd->data; |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
337 |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
338 wd->data = NULL; |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
339 free(oldflags); |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
340 } |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
341 } |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
342 |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
343 if(wd->oldproc) |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
344 WinSubclassWindow(handle, wd->oldproc); |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
345 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
346 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
|
347 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
|
348 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
|
349 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
350 |
3 | 351 henum = WinBeginEnumWindows(handle); |
352 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
353 _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
|
354 |
3 | 355 WinEndEnumWindows(henum); |
356 return; | |
357 } | |
358 | |
359 /* This function returns 1 if the window (widget) handle | |
360 * passed to it is a valid window that can gain input focus. | |
361 */ | |
362 int _validate_focus(HWND handle) | |
363 { | |
364 char tmpbuf[100]; | |
365 | |
366 if(!handle) | |
367 return 0; | |
368 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
369 if(!WinIsWindowEnabled(handle) || dw_window_get_data(handle, "_dw_disabled")) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
370 return 0; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
371 |
3 | 372 WinQueryClassName(handle, 99, tmpbuf); |
373 | |
374 /* These are the window classes which can | |
375 * obtain input focus. | |
376 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 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
|
383 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
|
384 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */ |
3 | 385 return 1; |
386 return 0; | |
387 } | |
388 | |
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
|
389 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) |
3 | 390 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
391 int z, n; |
3 | 392 static HWND lasthwnd, firsthwnd; |
393 static int finish_searching; | |
394 | |
395 /* Start is 2 when we have cycled completely and | |
396 * need to set the focus to the last widget we found | |
397 * that was valid. | |
398 */ | |
399 if(start == 2) | |
400 { | |
401 if(lasthwnd) | |
402 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
403 return 0; | |
404 } | |
405 | |
406 /* Start is 1 when we are entering the function | |
407 * for the first time, it is zero when entering | |
408 * the function recursively. | |
409 */ | |
410 if(start == 1) | |
411 { | |
412 lasthwnd = handle; | |
413 finish_searching = 0; | |
414 firsthwnd = 0; | |
415 } | |
416 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
417 for(n=0;n<box->count;n++) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
418 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
419 /* Vertical boxes are inverted on OS/2 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
420 if(box->type == DW_VERT) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
421 z = n; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
422 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
423 z = box->count - n - 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
424 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
425 if(box->items[z].type == TYPEBOX) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
426 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
427 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
428 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
429 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
430 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
431 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
432 else |
3 | 433 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
434 if(box->items[z].hwnd == handle) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
435 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
436 if(lasthwnd == handle && firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
437 WinSetFocus(HWND_DESKTOP, firsthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
438 else if(lasthwnd == handle && !firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
439 finish_searching = 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
440 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
441 WinSetFocus(HWND_DESKTOP, lasthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
442 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
443 /* If we aren't looking for the last handle, |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
444 * return immediately. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
445 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
446 if(!finish_searching) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
447 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
448 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
449 if(_validate_focus(box->items[z].hwnd)) |
3 | 450 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
451 /* Start is 3 when we are looking for the |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
452 * first valid item in the layout. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
453 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
454 if(start == 3) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
455 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
456 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
457 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
458 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
459 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
460 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
461 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
462 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
463 if(!firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
464 firsthwnd = box->items[z].hwnd; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
465 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
466 lasthwnd = box->items[z].hwnd; |
3 | 467 } |
468 else | |
469 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
470 char tmpbuf[100] = ""; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
471 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
472 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
473 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
3 | 474 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
475 /* Then try the bottom or right box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
476 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
477 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
478 if(mybox) |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
479 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
480 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
481 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
482 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
483 return 1; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
484 } |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
485 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
486 /* Try the top or left box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
487 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
488 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
489 if(mybox) |
3 | 490 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
491 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
492 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
493 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
494 return 1; |
3 | 495 } |
496 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
497 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 498 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
499 Box *notebox; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
500 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
501 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
502 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
503 if(page) |
3 | 504 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
505 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
506 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
507 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
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
|
508 return 1; |
3 | 509 } |
510 } | |
511 } | |
512 } | |
513 } | |
514 return 0; | |
515 } | |
516 | |
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
|
517 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
|
518 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
519 int z, n; |
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
|
520 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
|
521 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
|
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 /* 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
|
524 * 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
|
525 * 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
|
526 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
527 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
|
528 { |
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 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
|
530 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
|
531 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
|
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 |
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 /* 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
|
535 * 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
|
536 * 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
|
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 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
|
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 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
|
541 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
|
542 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
|
543 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
544 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
545 for(n=0;n<box->count;n++) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
546 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
547 /* Vertical boxes are inverted on OS/2 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
548 if(box->type == DW_VERT) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
549 z = box->count - n - 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
550 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
551 z = n; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
552 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
553 if(box->items[z].type == TYPEBOX) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
554 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
555 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
556 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
557 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
558 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
559 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
560 else |
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
|
561 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
562 if(box->items[z].hwnd == handle) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
563 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
564 if(lasthwnd == handle && firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
565 WinSetFocus(HWND_DESKTOP, firsthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
566 else if(lasthwnd == handle && !firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
567 finish_searching = 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
568 else |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
569 WinSetFocus(HWND_DESKTOP, lasthwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
570 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
571 /* If we aren't looking for the last handle, |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
572 * return immediately. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
573 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
574 if(!finish_searching) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
575 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
576 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
577 if(_validate_focus(box->items[z].hwnd)) |
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
|
578 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
579 /* Start is 3 when we are looking for the |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
580 * first valid item in the layout. |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
581 */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
582 if(start == 3) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
583 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
584 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
585 { |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
586 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
587 return 1; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
588 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
589 } |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
590 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
591 if(!firsthwnd) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
592 firsthwnd = box->items[z].hwnd; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
593 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
594 lasthwnd = box->items[z].hwnd; |
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
|
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 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
|
597 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
598 char tmpbuf[100] = ""; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
599 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
600 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
601 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
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
|
602 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
603 /* Try the top or left box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
604 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
605 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
606 if(mybox) |
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
|
607 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
608 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
609 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
610 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
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
|
611 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
|
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 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
614 /* Then try the bottom or right box */ |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
615 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
616 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
617 if(mybox) |
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
|
618 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
619 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
620 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
621 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
622 return 1; |
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
|
623 } |
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 } |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
625 else 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
|
626 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
627 Box *notebox; |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
628 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
629 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
630 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
631 if(page) |
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
|
632 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
633 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
634 |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
635 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) |
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
|
636 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
|
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 } |
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 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
641 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
642 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
|
643 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
644 |
3 | 645 /* This function finds the first widget in the |
646 * layout and moves the current focus to it. | |
647 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
648 int _initial_focus(HWND handle) |
3 | 649 { |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
650 Box *thisbox = NULL; |
3 | 651 HWND box; |
652 | |
653 box = WinWindowFromID(handle, FID_CLIENT); | |
654 if(box) | |
655 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
|
656 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
657 return 1; |
3 | 658 |
659 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
|
660 _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
|
661 return 0; |
3 | 662 } |
663 | |
664 /* This function finds the current widget in the | |
665 * layout and moves the current focus to the next item. | |
666 */ | |
667 void _shift_focus(HWND handle) | |
668 { | |
669 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
|
670 HWND box, lastbox = _toplevel_window(handle); |
3 | 671 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
672 box = WinWindowFromID(lastbox, FID_CLIENT); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
673 if(box) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
674 thisbox = WinQueryWindowPtr(box, QWP_USER); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
675 else |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
676 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
677 |
3 | 678 if(thisbox) |
679 { | |
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
|
680 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
|
681 _focus_check_box(thisbox, handle, 2, 0); |
3 | 682 } |
683 } | |
684 | |
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
|
685 /* 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
|
686 * 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
|
687 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
688 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
|
689 { |
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 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
|
691 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
|
692 |
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 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
|
694 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
|
695 thisbox = WinQueryWindowPtr(box, QWP_USER); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
696 else |
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
|
697 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
|
698 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
699 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
|
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 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
|
702 _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
|
703 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
704 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
705 |
3 | 706 /* This function will recursively search a box and add up the total height of it */ |
707 void _count_size(HWND box, int type, int *xsize, int *xorigsize) | |
708 { | |
709 int size = 0, origsize = 0, z; | |
710 Box *tmp = WinQueryWindowPtr(box, QWP_USER); | |
711 | |
712 if(!tmp) | |
713 { | |
714 *xsize = *xorigsize = 0; | |
715 return; | |
716 } | |
717 | |
718 if(type == tmp->type) | |
719 { | |
720 /* If the box is going in the direction we want, then we | |
721 * return the entire sum of the items. | |
722 */ | |
723 for(z=0;z<tmp->count;z++) | |
724 { | |
725 if(tmp->items[z].type == TYPEBOX) | |
726 { | |
727 int s, os; | |
728 | |
729 _count_size(tmp->items[z].hwnd, type, &s, &os); | |
730 size += s; | |
731 origsize += os; | |
732 } | |
733 else | |
734 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
735 size += (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
736 origsize += (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); |
3 | 737 } |
738 } | |
739 } | |
740 else | |
741 { | |
742 /* If the box is not going in the direction we want, then we only | |
743 * want to return the maximum value. | |
744 */ | |
745 int tmpsize = 0, tmporigsize = 0; | |
746 | |
747 for(z=0;z<tmp->count;z++) | |
748 { | |
749 if(tmp->items[z].type == TYPEBOX) | |
750 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); | |
751 else | |
752 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
753 tmpsize = (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); |
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
754 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); |
3 | 755 } |
756 | |
757 if(tmpsize > size) | |
758 size = tmpsize; | |
759 } | |
760 } | |
761 | |
762 *xsize = size; | |
763 *xorigsize = origsize; | |
764 } | |
765 | |
766 | |
767 /* Function: TrackRectangle | |
768 * Abstract: Tracks given rectangle. | |
769 * | |
770 * If rclBounds is NULL, then track rectangle on entire desktop. | |
771 * rclTrack is in window coorditates and will be mapped to | |
772 * desktop. | |
773 */ | |
774 | |
775 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) | |
776 { | |
777 TRACKINFO track; | |
778 APIRET rc; | |
779 | |
780 track.cxBorder = 1; | |
781 track.cyBorder = 1; | |
782 track.cxGrid = 1; | |
783 track.cyGrid = 1; | |
784 track.cxKeyboard = 8; | |
785 track.cyKeyboard = 8; | |
786 | |
787 if(!rclTrack) | |
788 return FALSE; | |
789 | |
790 if(rclBounds) | |
791 { | |
792 track.rclBoundary = *rclBounds; | |
793 } | |
794 else | |
795 { | |
796 track.rclBoundary.yTop = | |
797 track.rclBoundary.xRight = 3000; | |
798 track.rclBoundary.yBottom = | |
799 track.rclBoundary.xLeft = -3000; | |
800 } | |
801 | |
802 track.rclTrack = *rclTrack; | |
803 | |
804 WinMapWindowPoints(hwndBase, | |
805 HWND_DESKTOP, | |
806 (PPOINTL)&track.rclTrack, | |
807 2); | |
808 | |
809 track.ptlMinTrackSize.x = track.rclTrack.xRight | |
810 - track.rclTrack.xLeft; | |
811 track.ptlMinTrackSize.y = track.rclTrack.yTop | |
812 - track.rclTrack.yBottom; | |
813 track.ptlMaxTrackSize.x = track.rclTrack.xRight | |
814 - track.rclTrack.xLeft; | |
815 track.ptlMaxTrackSize.y = track.rclTrack.yTop | |
816 - track.rclTrack.yBottom; | |
817 | |
818 track.fs = TF_MOVE | TF_ALLINBOUNDARY; | |
819 | |
820 rc = WinTrackRect(HWND_DESKTOP, 0, &track); | |
821 | |
822 if(rc) | |
823 *rclTrack = track.rclTrack; | |
824 | |
825 return rc; | |
826 } | |
827 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
828 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
|
829 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
830 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
|
831 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
832 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
|
833 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
834 /* 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
|
835 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
|
836 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
837 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
|
838 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
|
839 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
840 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
|
841 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
842 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
|
843 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
|
844 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
845 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
|
846 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
|
847 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
848 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
|
849 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
850 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
|
851 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
|
852 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
|
853 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
|
854 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
855 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
|
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 _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
|
858 } |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
859 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, (MPARAM)page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR)); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
860 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
861 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
862 } |
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 |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
865 /* Return the OS/2 color from the DW color */ |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
866 unsigned long _internal_color(unsigned long color) |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
867 { |
224
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
868 if(color < 16) |
e6571c4e4d3b
Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
220
diff
changeset
|
869 return _colors[color]; |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
870 return color; |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
871 } |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
872 |
3 | 873 /* This function calculates how much space the widgets and boxes require |
874 * and does expansion as necessary. | |
875 */ | |
876 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy, | |
877 int pass, int *usedpadx, int *usedpady) | |
878 { | |
879 int z, currentx = 0, currenty = 0; | |
880 int uymax = 0, uxmax = 0; | |
881 int upymax = 0, upxmax = 0; | |
882 /* Used for the SIZEEXPAND */ | |
883 int nux = *usedx, nuy = *usedy; | |
884 int nupx = *usedpadx, nupy = *usedpady; | |
885 | |
886 (*usedx) += (thisbox->pad * 2); | |
887 (*usedy) += (thisbox->pad * 2); | |
888 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
889 if(thisbox->grouphwnd) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
890 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
891 char *text = dw_window_get_text(thisbox->grouphwnd); |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
892 |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
893 thisbox->grouppady = 0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
894 |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
895 if(text) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
896 { |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
897 dw_font_text_extents(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
898 dw_free(text); |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
899 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
900 |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
901 if(thisbox->grouppady) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
902 thisbox->grouppady += 3; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
903 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
904 thisbox->grouppady = 6; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
905 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
906 thisbox->grouppadx = 6; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
907 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
908 (*usedx) += thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
909 (*usedpadx) += thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
910 (*usedy) += thisbox->grouppady; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
911 (*usedpady) += thisbox->grouppady; |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
912 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
913 |
3 | 914 for(z=0;z<thisbox->count;z++) |
915 { | |
916 if(thisbox->items[z].type == TYPEBOX) | |
917 { | |
918 int initialx, initialy; | |
919 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
920 | |
921 initialx = x - (*usedx); | |
922 initialy = y - (*usedy); | |
923 | |
924 if(tmp) | |
925 { | |
926 int newx, newy; | |
927 int nux = *usedx, nuy = *usedy; | |
928 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2); | |
929 | |
930 /* On the second pass we know how big the box needs to be and how | |
931 * much space we have, so we can calculate a ratio for the new box. | |
932 */ | |
933 if(pass == 2) | |
934 { | |
935 int deep = *depth + 1; | |
936 | |
937 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy); | |
938 | |
939 tmp->upx = upx - *usedpadx; | |
940 tmp->upy = upy - *usedpady; | |
941 | |
942 newx = x - nux; | |
943 newy = y - nuy; | |
944 | |
945 tmp->width = thisbox->items[z].width = initialx - newx; | |
946 tmp->height = thisbox->items[z].height = initialy - newy; | |
947 | |
948 tmp->parentxratio = thisbox->xratio; | |
949 tmp->parentyratio = thisbox->yratio; | |
950 | |
951 tmp->parentpad = tmp->pad; | |
952 | |
953 /* Just in case */ | |
954 tmp->xratio = thisbox->xratio; | |
955 tmp->yratio = thisbox->yratio; | |
956 | |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
957 if(thisbox->type == DW_VERT) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
958 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
959 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppady; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
960 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
961 if((thisbox->items[z].width - tmppad)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
962 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmppad))/((float)(thisbox->items[z].width-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
963 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
964 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
965 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
966 if((thisbox->items[z].width-tmp->upx)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
967 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
968 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
969 if(thisbox->type == DW_HORZ) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
970 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
971 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
972 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
973 if((thisbox->items[z].height-tmppad)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
974 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmppad))/((float)(thisbox->items[z].height-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
975 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
976 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
977 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
978 if((thisbox->items[z].height-tmp->upy)!=0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
979 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
980 } |
3 | 981 |
982 nux = *usedx; nuy = *usedy; | |
983 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | |
984 } | |
985 | |
986 (*depth)++; | |
987 | |
988 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); | |
989 | |
990 (*depth)--; | |
991 | |
992 newx = x - nux; | |
993 newy = y - nuy; | |
994 | |
995 tmp->minwidth = thisbox->items[z].width = initialx - newx; | |
996 tmp->minheight = thisbox->items[z].height = initialy - newy; | |
997 } | |
998 } | |
999 | |
1000 if(pass > 1 && *depth > 0) | |
1001 { | |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1002 if(thisbox->type == DW_VERT) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1003 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1004 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1005 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1006 if((thisbox->minwidth-tmppad) == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1007 thisbox->items[z].xratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1008 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1009 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-tmppad))/((float)(thisbox->minwidth-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1010 } |
3 | 1011 else |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1012 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1013 if(thisbox->minwidth-thisbox->upx == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1014 thisbox->items[z].xratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1015 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1016 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1017 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1018 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1019 if(thisbox->type == DW_HORZ) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1020 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1021 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppady; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1022 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1023 if((thisbox->minheight-tmppad) == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1024 thisbox->items[z].yratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1025 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1026 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-tmppad))/((float)(thisbox->minheight-tmppad)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1027 } |
3 | 1028 else |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1029 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1030 if(thisbox->minheight-thisbox->upy == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1031 thisbox->items[z].yratio = 1.0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1032 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1033 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1034 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1035 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1036 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
|
1037 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1038 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
|
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 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
|
1041 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1042 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
|
1043 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
|
1044 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1045 } |
3 | 1046 } |
1047 else | |
1048 { | |
1049 thisbox->items[z].xratio = thisbox->xratio; | |
1050 thisbox->items[z].yratio = thisbox->yratio; | |
1051 } | |
1052 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1053 if(thisbox->type == DW_VERT) |
3 | 1054 { |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1055 int itemwidth = thisbox->items[z].width + (thisbox->items[z].pad*2); |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1056 |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1057 if(itemwidth > uxmax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1058 uxmax = itemwidth; |
3 | 1059 if(thisbox->items[z].hsize != SIZEEXPAND) |
1060 { | |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1061 if(itemwidth > upxmax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1062 upxmax = itemwidth; |
3 | 1063 } |
1064 else | |
1065 { | |
1066 if(thisbox->items[z].pad*2 > upxmax) | |
1067 upxmax = thisbox->items[z].pad*2; | |
1068 } | |
1069 } | |
1070 else | |
1071 { | |
1072 if(thisbox->items[z].width == -1) | |
1073 { | |
1074 /* figure out how much space this item requires */ | |
1075 /* thisbox->items[z].width = */ | |
1076 } | |
1077 else | |
1078 { | |
1079 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
1080 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1081 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1082 else | |
1083 (*usedpadx) += thisbox->items[z].pad*2; | |
1084 } | |
1085 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1086 if(thisbox->type == DW_HORZ) |
3 | 1087 { |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1088 int itemheight = thisbox->items[z].height + (thisbox->items[z].pad*2); |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1089 |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1090 if(itemheight > uymax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1091 uymax = itemheight; |
3 | 1092 if(thisbox->items[z].vsize != SIZEEXPAND) |
1093 { | |
452
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1094 if(itemheight > upymax) |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1095 upymax = itemheight; |
3 | 1096 } |
1097 else | |
1098 { | |
1099 if(thisbox->items[z].pad*2 > upymax) | |
1100 upymax = thisbox->items[z].pad*2; | |
1101 } | |
1102 } | |
1103 else | |
1104 { | |
1105 if(thisbox->items[z].height == -1) | |
1106 { | |
1107 /* figure out how much space this item requires */ | |
1108 /* thisbox->items[z].height = */ | |
1109 } | |
1110 else | |
1111 { | |
1112 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
1113 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1114 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1115 else | |
1116 (*usedpady) += thisbox->items[z].pad*2; | |
1117 } | |
1118 } | |
1119 } | |
1120 | |
1121 (*usedx) += uxmax; | |
1122 (*usedy) += uymax; | |
1123 (*usedpadx) += upxmax; | |
1124 (*usedpady) += upymax; | |
1125 | |
1126 currentx += thisbox->pad; | |
1127 currenty += thisbox->pad; | |
1128 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1129 if(thisbox->grouphwnd) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1130 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1131 currentx += 3; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1132 currenty += 3; |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1133 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1134 |
3 | 1135 /* The second pass is for expansion and actual placement. */ |
1136 if(pass > 1) | |
1137 { | |
1138 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | |
1139 for(z=0;z<thisbox->count;z++) | |
1140 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1141 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT) |
3 | 1142 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1143 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) |
3 | 1144 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); |
1145 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | |
1146 if(thisbox->items[z].type == TYPEBOX) | |
1147 { | |
1148 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
1149 | |
1150 if(tmp) | |
1151 { | |
1152 if(*depth > 0) | |
1153 { | |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1154 float calcval; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1155 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1156 if(thisbox->type == DW_VERT) |
3 | 1157 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1158 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2))); |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1159 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1160 tmp->xratio = thisbox->xratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1161 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1162 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1163 tmp->width = thisbox->items[z].width; |
1164 } | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1165 if(thisbox->type == DW_HORZ) |
3 | 1166 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1167 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2))); |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1168 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1169 tmp->yratio = thisbox->yratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1170 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1171 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1172 tmp->height = thisbox->items[z].height; |
1173 } | |
1174 } | |
1175 | |
1176 (*depth)++; | |
1177 | |
1178 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); | |
1179 | |
1180 (*depth)--; | |
1181 | |
1182 } | |
1183 } | |
1184 } | |
1185 | |
1186 for(z=0;z<(thisbox->count);z++) | |
1187 { | |
1188 int height = thisbox->items[z].height; | |
1189 int width = thisbox->items[z].width; | |
1190 int pad = thisbox->items[z].pad; | |
1191 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
|
1192 int vectorx, vectory; |
3 | 1193 |
1194 /* When upxmax != pad*2 then ratios are incorrect. */ | |
1195 vectorx = (int)((width*thisbox->items[z].xratio)-width); | |
1196 vectory = (int)((height*thisbox->items[z].yratio)-height); | |
1197 | |
1198 if(width > 0 && height > 0) | |
1199 { | |
1200 char tmpbuf[100]; | |
1201 /* This is a hack to fix rounding of the sizing */ | |
1202 if(*depth == 0) | |
1203 { | |
1204 vectorx++; | |
1205 vectory++; | |
1206 } | |
1207 | |
1208 /* If this item isn't going to expand... reset the vectors to 0 */ | |
1209 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1210 vectory = 0; | |
1211 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1212 vectorx = 0; | |
1213 | |
1214 WinQueryClassName(handle, 99, tmpbuf); | |
1215 | |
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
|
1216 if(strncmp(tmpbuf, "#2", 3)==0) |
3 | 1217 { |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1218 HWND frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
3 | 1219 /* Make the combobox big enough to drop down. :) */ |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1220 WinSetWindowPos(handle, HWND_TOP, 0, -100, |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1221 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1222 WinSetWindowPos(frame, HWND_TOP, currentx + pad, currenty + pad, |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
1223 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
3 | 1224 } |
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
|
1225 else if(strncmp(tmpbuf, "#6", 3)==0) |
3 | 1226 { |
1227 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ | |
1228 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, | |
1229 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1230 } | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1231 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
|
1232 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1233 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
|
1234 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
|
1235 _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
|
1236 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1237 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1238 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1239 /* Then try the bottom or right box */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1240 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1241 int type = (int)dw_window_get_data(handle, "_dw_type"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1242 int cx = width + vectorx; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1243 int cy = height + vectory; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1244 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1245 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1246 cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1247 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1248 if(cx > 0 && cy > 0 && percent) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1249 _handle_splitbar_resize(handle, *percent, type, cx, cy); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1250 } |
3 | 1251 else |
1252 { | |
1253 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad, | |
1254 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); | |
1255 if(thisbox->items[z].type == TYPEBOX) | |
1256 { | |
1257 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER); | |
1258 | |
1259 if(boxinfo && boxinfo->grouphwnd) | |
1260 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
|
1261 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE); |
3 | 1262 |
1263 } | |
1264 | |
1265 } | |
1266 | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1267 if(thisbox->type == DW_HORZ) |
3 | 1268 currentx += width + vectorx + (pad * 2); |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
1269 if(thisbox->type == DW_VERT) |
3 | 1270 currenty += height + vectory + (pad * 2); |
1271 } | |
1272 } | |
1273 } | |
1274 return 0; | |
1275 } | |
1276 | |
1277 void _do_resize(Box *thisbox, int x, int y) | |
1278 { | |
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
|
1279 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
|
1280 { |
3 | 1281 if(thisbox) |
1282 { | |
1283 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; | |
1284 | |
1285 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady); | |
1286 | |
1287 if(usedx-usedpadx == 0 || usedy-usedpady == 0) | |
1288 return; | |
1289 | |
1290 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); | |
1291 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); | |
1292 | |
1293 usedx = usedy = usedpadx = usedpady = depth = 0; | |
1294 | |
1295 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); | |
1296 } | |
1297 } | |
1298 } | |
1299 | |
1300 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ | |
1301 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1302 { | |
1303 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
|
1304 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
|
1305 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
|
1306 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1307 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
|
1308 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
|
1309 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
|
1310 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1311 if(thisbox && !thisbox->titlebar) |
3 | 1312 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1313 switch(msg) |
3 | 1314 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1315 case WM_QUERYTRACKINFO: |
3 | 1316 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1317 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
|
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 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
|
1320 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
|
1321 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
|
1322 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
|
1323 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1324 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
|
1325 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1326 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
|
1327 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
|
1328 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1329 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
|
1330 } |
3 | 1331 } |
1332 } | |
1333 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1334 |
3 | 1335 if(blah && *blah) |
1336 { | |
1337 PFNWP myfunc = *blah; | |
1338 return myfunc(hWnd, msg, mp1, mp2); | |
1339 } | |
1340 | |
1341 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1342 } | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1343 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1344 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
|
1345 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1346 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
|
1347 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1348 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
|
1349 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
|
1350 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
|
1351 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
|
1352 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
|
1353 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1354 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1355 /* 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
|
1356 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
|
1357 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1358 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
|
1359 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1360 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
|
1361 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
|
1362 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
|
1363 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
|
1364 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
|
1365 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1366 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1367 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
|
1368 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1369 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
|
1370 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1371 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
|
1372 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
|
1373 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
|
1374 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
|
1375 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
|
1376 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1377 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1378 /* 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
|
1379 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
|
1380 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1381 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
|
1382 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1383 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
|
1384 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
|
1385 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
|
1386 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
|
1387 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
|
1388 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1389 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1390 /* This procedure handles drawing of a status border */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1391 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
|
1392 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1393 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1394 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1395 if(blah && *blah) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1396 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1397 PFNWP myfunc = *blah; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1398 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1399 switch(msg) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1400 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1401 case WM_PAINT: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1402 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1403 HPS hpsPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1404 RECTL rclPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1405 char buf[1024]; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1406 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1407 hpsPaint = WinBeginPaint(hWnd, 0, 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1408 WinQueryWindowRect(hWnd, &rclPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1409 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1410 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1411 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
|
1412 _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
|
1413 _Left(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1414 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1415 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
|
1416 _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
|
1417 _Bottom(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1418 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1419 WinQueryWindowText(hWnd, 1024, buf); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1420 rclPaint.xLeft += 3; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1421 rclPaint.xRight--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1422 rclPaint.yTop--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1423 rclPaint.yBottom++; |
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 GpiSetColor(hpsPaint, CLR_BLACK); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1426 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
|
1427 WinEndPaint(hpsPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1428 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1429 return (MRESULT)TRUE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1430 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1431 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1432 return myfunc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1433 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1434 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1435 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1436 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1437 |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1438 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
|
1439 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1440 char tmpbuf[100]; |
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 WinQueryClassName(handle, 99, tmpbuf); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1443 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1444 /* 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
|
1445 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1446 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1447 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
|
1448 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1449 /* 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
|
1450 SignalHandler *tmp = Root; |
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 /* 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
|
1453 while(tmp) |
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 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
|
1456 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1457 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
|
1458 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1459 /* 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
|
1460 if(tmp->window == handle) |
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 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
|
1463 tmp = NULL; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1464 } |
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 if(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1467 tmp= tmp->next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1468 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1469 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1470 else |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1471 WinSetFocus(HWND_DESKTOP, handle); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1472 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1473 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1474 #define ENTRY_CUT 1001 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1475 #define ENTRY_COPY 1002 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1476 #define ENTRY_PASTE 1003 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1477 #define ENTRY_UNDO 1004 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1478 #define ENTRY_SALL 1005 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1479 |
3 | 1480 /* Originally just intended for entryfields, it now serves as a generic |
1481 * procedure for handling TAB presses to change input focus on controls. | |
1482 */ | |
1483 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1484 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1485 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
|
1486 PFNWP oldproc = 0; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1487 char tmpbuf[100]; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1488 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1489 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1490 oldproc = blah->oldproc; |
3 | 1491 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1492 WinQueryClassName(hWnd, 99, tmpbuf); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1493 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1494 /* These are the window classes which should get a menu */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1495 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1496 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1497 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1498 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1499 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1500 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1501 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1502 case WM_CONTEXTMENU: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1503 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1504 HMENUI hwndMenu = dw_menu_new(0L); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1505 long x, y; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1506 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1507 if(strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0)) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1508 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1509 dw_menu_append_item(hwndMenu, "Undo", ENTRY_UNDO, 0L, TRUE, FALSE, 0L); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1510 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1511 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1512 dw_menu_append_item(hwndMenu, "Copy", ENTRY_COPY, 0L, TRUE, FALSE, 0L); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1513 if((strncmp(tmpbuf, "#10", 4)!=0 && !dw_window_get_data(hWnd, "_dw_disabled")) || (strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0))) |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1514 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1515 dw_menu_append_item(hwndMenu, "Cut", ENTRY_CUT, 0L, TRUE, FALSE, 0L); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1516 dw_menu_append_item(hwndMenu, "Paste", ENTRY_PASTE, 0L, TRUE, FALSE, 0L); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1517 } |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1518 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1519 dw_menu_append_item(hwndMenu, "Select All", ENTRY_SALL, 0L, TRUE, FALSE, 0L); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1520 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1521 WinSetFocus(HWND_DESKTOP, hWnd); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1522 dw_pointer_query_pos(&x, &y); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1523 dw_menu_popup(&hwndMenu, hWnd, x, y); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1524 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1525 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1526 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1527 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1528 ULONG command = COMMANDMSG(&msg)->cmd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1529 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1530 /* MLE */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1531 if(strncmp(tmpbuf, "#10", 4)==0) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1532 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1533 switch(command) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1534 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1535 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1536 return WinSendMsg(hWnd, MLM_CUT, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1537 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1538 return WinSendMsg(hWnd, MLM_COPY, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1539 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1540 return WinSendMsg(hWnd, MLM_PASTE, 0, 0); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1541 case ENTRY_UNDO: |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1542 return WinSendMsg(hWnd, MLM_UNDO, 0, 0); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1543 case ENTRY_SALL: |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1544 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1545 ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1546 return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1547 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1548 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1549 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1550 else /* Other */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1551 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1552 HWND handle = hWnd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1553 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1554 /* Get the entryfield handle from multi window controls */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1555 if(strncmp(tmpbuf, "#2", 3)==0) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1556 handle = WinWindowFromID(hWnd, 667); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1557 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1558 if(handle) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1559 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1560 switch(command) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1561 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1562 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1563 return WinSendMsg(handle, EM_CUT, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1564 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1565 return WinSendMsg(handle, EM_COPY, 0, 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1566 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1567 return WinSendMsg(handle, EM_PASTE, 0, 0); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1568 case ENTRY_SALL: |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1569 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1570 LONG len = WinQueryWindowTextLength(hWnd); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1571 return WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT(0, (SHORT)len), 0); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1572 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1573 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1574 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1575 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1576 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1577 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1578 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1579 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1580 |
3 | 1581 switch(msg) |
1582 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1583 case WM_BUTTON1DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1584 case WM_BUTTON2DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1585 case WM_BUTTON3DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1586 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1587 if(strncmp(tmpbuf, "#32", 4)==0) |
38
538db2a48bac
Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1588 _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
|
1589 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1590 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
|
1591 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
|
1592 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1593 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
|
1594 _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
|
1595 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1596 break; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1597 case WM_SETFOCUS: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1598 _run_event(hWnd, msg, mp1, mp2); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1599 break; |
3 | 1600 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1601 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1602 return (MRESULT)TRUE; |
3 | 1603 if(SHORT1FROMMP(mp2) == '\t') |
1604 { | |
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
|
1605 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
|
1606 _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
|
1607 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
|
1608 _shift_focus(hWnd); |
3 | 1609 return FALSE; |
1610 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1611 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
|
1612 _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
|
1613 /* 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
|
1614 * 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
|
1615 */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1616 else if(SHORT1FROMMP(mp2) == 283) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
1617 return (MRESULT)TRUE; |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1618 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1619 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1620 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
|
1621 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1622 /* 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
|
1623 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
|
1624 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
|
1625 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1626 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1627 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
|
1628 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1629 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
|
1630 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
|
1631 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1632 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1633 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1634 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1635 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
|
1636 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
|
1637 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1638 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
|
1639 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1640 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1641 /* Deal with combobox specifics and enhancements */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1642 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1643 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1644 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1645 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1646 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1647 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1648 case WM_CONTEXTMENU: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1649 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1650 return _entryproc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1651 case WM_SETFOCUS: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1652 _run_event(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1653 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1654 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1655 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
1656 return (MRESULT)TRUE; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1657 /* A Similar problem to the MLE, if ESC just return */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1658 if(SHORT1FROMMP(mp2) == 283) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1659 return (MRESULT)TRUE; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1660 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1661 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1662 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1663 if(blah && blah->oldproc) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1664 return blah->oldproc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1665 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1666 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1667 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1668 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1669 /* Enhance the standard OS/2 MLE control */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1670 MRESULT EXPENTRY _mleproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1671 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1672 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1673 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1674 case WM_VSCROLL: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1675 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1676 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1677 USHORT pos = SHORT1FROMMP(mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1678 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1679 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION)); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1680 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1681 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1682 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1683 return _entryproc(hWnd, msg, mp1, mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1684 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1685 |
156 | 1686 /* Handle special messages for the spinbutton's entryfield */ |
1687 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1688 { | |
1689 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | |
1690 PFNWP oldproc = 0; | |
1691 | |
1692 if(blah) | |
1693 oldproc = blah->oldproc; | |
1694 | |
1695 switch(msg) | |
1696 { | |
1697 case WM_CONTEXTMENU: | |
1698 case WM_COMMAND: | |
1699 return _entryproc(hWnd, msg, mp1, mp2); | |
1700 } | |
1701 | |
1702 if(oldproc) | |
1703 return oldproc(hWnd, msg, mp1, mp2); | |
1704 | |
1705 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1706 } | |
1707 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1708 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
|
1709 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1710 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
|
1711 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
|
1712 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
|
1713 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
|
1714 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
|
1715 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
|
1716 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1717 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1718 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
|
1719 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1720 int inew, range = dw_percent_query_range(hwnd); |
116
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1721 if(range) |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1722 { |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1723 float fpos = (float)pos; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1724 float frange = (float)range; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1725 float fnew = (fpos/frange)*1000.0; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1726 inew = (int)fnew; |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1727 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew); |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1728 } |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1729 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1730 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1731 /* 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
|
1732 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
|
1733 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1734 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
|
1735 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
|
1736 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1737 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
|
1738 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
|
1739 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1740 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
|
1741 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1742 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
|
1743 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
|
1744 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1745 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
|
1746 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd)); |
3 | 1747 break; |
1748 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1749 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1750 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1751 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1752 |
1753 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1754 } | |
1755 | |
1756 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN | |
1757 * flag enabled, and also handle TABs to switch input focus. | |
1758 */ | |
1759 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1760 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1761 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
|
1762 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
|
1763 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1764 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1765 oldproc = blah->oldproc; |
3 | 1766 |
1767 switch(msg) | |
1768 { | |
1769 case WM_CHAR: | |
1770 if(SHORT1FROMMP(mp2) == '\t') | |
1771 { | |
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
|
1772 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
|
1773 _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
|
1774 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
|
1775 _shift_focus(hWnd); |
3 | 1776 return FALSE; |
1777 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1778 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
|
1779 _click_default(blah->clickdefault); |
3 | 1780 break; |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1781 case WM_BUTTON1DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1782 case WM_BUTTON2DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1783 case WM_BUTTON3DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1784 if(dw_window_get_data(hWnd, "_dw_disabled")) |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1785 return (MRESULT)TRUE; |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1786 break; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1787 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
|
1788 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
|
1789 case WM_BUTTON3DOWN: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1790 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE) |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1791 return (MRESULT)TRUE; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1792 _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
|
1793 break; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1794 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
|
1795 _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
|
1796 break; |
3 | 1797 case WM_PAINT: |
1798 { | |
406
765ec42ee2e4
Minor fix, we need to check the parent of the container widget instead of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
405
diff
changeset
|
1799 HWND entry, frame = (HWND)dw_window_get_data(hWnd, "_dw_combo_box"), parent = WinQueryWindow(frame, QW_PARENT); |
3 | 1800 HPS hpsPaint; |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1801 POINTL ptl; |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1802 unsigned long width, height, thumbheight = 0; |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1803 ULONG color; |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1804 |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1805 if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE) |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1806 dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight); |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1807 |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1808 if(!thumbheight) |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1809 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW); |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1810 |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1811 /* Add 6 because it has a thick border like the entryfield */ |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1812 thumbheight += 6; |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1813 |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1814 color = (ULONG)dw_window_get_data(parent, "_dw_fore"); |
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
1815 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); |
3 | 1816 |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1817 if(height > thumbheight) |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1818 { |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1819 hpsPaint = WinGetPS(hWnd); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1820 if(color) |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1821 GpiSetColor(hpsPaint, _internal_color(color-1)); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1822 else |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1823 GpiSetColor(hpsPaint, CLR_PALEGRAY); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1824 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1825 ptl.x = ptl.y = 0; |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1826 GpiMove(hpsPaint, &ptl); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1827 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1828 ptl.x = width; |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1829 ptl.y = height - thumbheight; |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1830 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1831 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1832 WinReleasePS(hpsPaint); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
1833 } |
3 | 1834 } |
1835 break; | |
1836 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1837 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1838 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1839 |
1840 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1841 } | |
1842 | |
1843 void _GetPPFont(HWND hwnd, char *buff) | |
1844 { | |
1845 ULONG AttrFound; | |
1846 BYTE AttrValue[128]; | |
1847 ULONG cbRetLen; | |
1848 | |
1849 cbRetLen = WinQueryPresParam(hwnd, | |
1850 PP_FONTNAMESIZE, | |
1851 0, | |
1852 &AttrFound, | |
1853 sizeof(AttrValue), | |
1854 &AttrValue, | |
1855 QPF_NOINHERIT); | |
1856 | |
1857 if(PP_FONTNAMESIZE == AttrFound && cbRetLen) | |
1858 { | |
1859 memcpy(buff, AttrValue, cbRetLen); | |
1860 } | |
1861 } | |
1862 | |
1863 /* Returns height of specified window. */ | |
1864 int _get_height(HWND handle) | |
1865 { | |
1866 unsigned long height; | |
1867 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); | |
1868 return (int)height; | |
1869 } | |
1870 | |
1871 /* Find the height of the frame a desktop style window is sitting on */ | |
1872 int _get_frame_height(HWND handle) | |
1873 { | |
1874 while(handle) | |
1875 { | |
1876 HWND client; | |
1877 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) | |
1878 { | |
1879 return _get_height(WinQueryWindow(handle, QW_PARENT)); | |
1880 } | |
1881 handle = WinQueryWindow(handle, QW_PARENT); | |
1882 } | |
1883 return dw_screen_height(); | |
1884 } | |
1885 | |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1886 int _HandleScroller(HWND handle, int pos, int which) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1887 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1888 MPARAM res; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1889 int min, max, page; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1890 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1891 if(which == SB_SLIDERTRACK) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1892 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1893 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1894 pos = dw_scrollbar_query_pos(handle); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1895 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1896 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1897 min = SHORT1FROMMP(res); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1898 max = SHORT2FROMMP(res); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1899 page = (int)dw_window_get_data(handle, "_dw_scrollbar_visible"); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1900 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1901 switch(which) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1902 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1903 case SB_LINEUP: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1904 pos = pos - 1; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1905 if(pos < min) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1906 pos = min; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1907 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1908 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1909 case SB_LINEDOWN: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1910 pos = pos + 1; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1911 if(pos > max) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1912 pos = max; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1913 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1914 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1915 case SB_PAGEUP: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1916 pos = pos - page; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1917 if(pos < min) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1918 pos = min; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1919 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1920 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1921 case SB_PAGEDOWN: |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1922 pos = pos + page; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1923 if(pos > max) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1924 pos = max; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1925 dw_scrollbar_set_pos(handle, pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1926 return pos; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1927 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1928 return -1; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1929 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
1930 |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1931 void _clear_emphasis(void) |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1932 { |
315
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
1933 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph) |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1934 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE)); |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1935 hwndEmph = NULLHANDLE; |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1936 pCoreEmph = NULL; |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1937 } |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
1938 |
3 | 1939 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1940 { | |
1941 int result = -1; | |
1942 SignalHandler *tmp = Root; | |
1943 ULONG origmsg = msg; | |
1944 | |
1945 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) | |
1946 msg = WM_BUTTON1DOWN; | |
1947 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) | |
1948 msg = WM_BUTTON1UP; | |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
1949 if(msg == WM_VSCROLL || msg == WM_HSCROLL) |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
1950 msg = WM_CONTROL; |
3 | 1951 |
1952 /* Find any callbacks for this function */ | |
1953 while(tmp) | |
1954 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1955 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1) |
3 | 1956 { |
1957 switch(msg) | |
1958 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1959 case WM_SETFOCUS: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1960 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1961 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
|
1962 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
1963 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1964 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1965 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
|
1966 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1967 result = setfocusfunc(tmp->window, tmp->data); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1968 tmp = NULL; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1969 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1970 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1971 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
1972 break; |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1973 case WM_TIMER: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1974 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1975 int (* API timerfunc)(void *) = (int (* API)(void *))tmp->signalfunction; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1976 if(tmp->id == (int)mp1) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1977 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1978 if(!timerfunc(tmp->data)) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1979 dw_timer_disconnect(tmp->id); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1980 tmp = NULL; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1981 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1982 result = 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1983 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
1984 break; |
3 | 1985 case WM_SIZE: |
1986 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
1987 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction; |
3 | 1988 |
276
dfbda83b7cad
Eliminate configure event callbacks when either the width or height is 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
267
diff
changeset
|
1989 if((hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) && SHORT1FROMMP(mp2) && SHORT2FROMMP(mp2)) |
3 | 1990 { |
1991 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data); | |
1992 tmp = NULL; | |
1993 } | |
1994 } | |
1995 break; | |
1996 case WM_BUTTON1DOWN: | |
1997 { | |
1998 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
1999 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2000 |
2001 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2002 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2003 int button = 0; |
3 | 2004 |
2005 switch(origmsg) | |
2006 { | |
2007 case WM_BUTTON1DOWN: | |
2008 button = 1; | |
2009 break; | |
2010 case WM_BUTTON2DOWN: | |
2011 button = 2; | |
2012 break; | |
2013 case WM_BUTTON3DOWN: | |
2014 button = 3; | |
2015 break; | |
2016 } | |
2017 | |
2018 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data); | |
2019 tmp = NULL; | |
2020 } | |
2021 } | |
2022 break; | |
2023 case WM_BUTTON1UP: | |
2024 { | |
2025 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2026 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2027 |
2028 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2029 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2030 int button = 0; |
3 | 2031 |
2032 switch(origmsg) | |
2033 { | |
2034 case WM_BUTTON1UP: | |
2035 button = 1; | |
2036 break; | |
2037 case WM_BUTTON2UP: | |
2038 button = 2; | |
2039 break; | |
2040 case WM_BUTTON3UP: | |
2041 button = 3; | |
2042 break; | |
2043 } | |
2044 | |
2045 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); | |
2046 tmp = NULL; | |
2047 } | |
2048 } | |
2049 break; | |
2050 case WM_MOUSEMOVE: | |
2051 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2052 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2053 |
2054 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2055 { | |
2056 int keys = 0; | |
2057 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1); | |
2058 | |
2059 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) | |
2060 keys = DW_BUTTON1_MASK; | |
2061 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) | |
2062 keys |= DW_BUTTON2_MASK; | |
2063 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) | |
2064 keys |= DW_BUTTON3_MASK; | |
2065 | |
2066 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data); | |
2067 tmp = NULL; | |
2068 } | |
2069 } | |
2070 break; | |
2071 case WM_CHAR: | |
2072 { | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2073 int (* API keypressfunc)(HWND, char, int, int, void *) = (int (* API)(HWND, char, int, int, void *))tmp->signalfunction; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2074 |
300
4559a2fd2db2
Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2075 if((hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP)) |
3 | 2076 { |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2077 int vk; |
293
315812516608
Changes to the key press handling, if the character is zero check the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
290
diff
changeset
|
2078 char ch = 0; |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2079 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2080 if(SHORT1FROMMP(mp1) & KC_CHAR) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2081 ch = (char)SHORT1FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2082 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2083 vk = SHORT2FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2084 else |
300
4559a2fd2db2
Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
298
diff
changeset
|
2085 vk = SHORT1FROMMP(mp2) + 128; |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2086 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2087 /* This is a hack to fix shift presses showing |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2088 * up as tabs! |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2089 */ |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2090 if(ch == '\t' && !(SHORT1FROMMP(mp1) & KC_CHAR)) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2091 { |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2092 ch = 0; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2093 vk = VK_SHIFT; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2094 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2095 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2096 result = keypressfunc(tmp->window, ch, vk, |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2097 SHORT1FROMMP(mp1) & (KC_ALT | KC_SHIFT | KC_CTRL), tmp->data); |
3 | 2098 tmp = NULL; |
2099 } | |
2100 } | |
2101 break; | |
2102 case WM_CLOSE: | |
2103 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2104 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2105 |
2106 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT)) | |
2107 { | |
2108 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
|
2109 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
|
2110 result = FALSE; |
3 | 2111 tmp = NULL; |
2112 } | |
2113 } | |
2114 break; | |
2115 case WM_PAINT: | |
2116 { | |
2117 HPS hps; | |
2118 DWExpose exp; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2119 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction; |
3 | 2120 RECTL rc; |
2121 | |
2122 if(hWnd == tmp->window) | |
2123 { | |
2124 int height = _get_height(hWnd); | |
2125 | |
2126 hps = WinBeginPaint(hWnd, 0L, &rc); | |
2127 exp.x = rc.xLeft; | |
2128 exp.y = height - rc.yTop - 1; | |
2129 exp.width = rc.xRight - rc. xLeft; | |
2130 exp.height = rc.yTop - rc.yBottom; | |
2131 result = exposefunc(hWnd, &exp, tmp->data); | |
2132 WinEndPaint(hps); | |
2133 } | |
2134 } | |
2135 break; | |
2136 case WM_COMMAND: | |
2137 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2138 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2139 ULONG command = COMMANDMSG(&msg)->cmd; |
2140 | |
2141 if(tmp->window < 65536 && command == tmp->window) | |
2142 { | |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
2143 result = clickfunc(popup ? popup : tmp->window, tmp->data); |
3 | 2144 tmp = NULL; |
2145 } | |
2146 } | |
2147 break; | |
2148 case WM_CONTROL: | |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2149 if(origmsg == WM_VSCROLL || origmsg == WM_HSCROLL || tmp->message == SHORT2FROMMP(mp1) || |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2150 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE)) |
3 | 2151 { |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2152 int svar = SLN_SLIDERTRACK; |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2153 if(origmsg == WM_CONTROL) |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2154 svar = SHORT2FROMMP(mp1); |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2155 |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2156 switch(svar) |
3 | 2157 { |
2158 case CN_ENTER: | |
2159 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2160 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction; |
3 | 2161 int id = SHORT1FROMMP(mp1); |
2162 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2163 char *text = NULL; | |
2164 | |
2165 if(mp2) | |
2166 { | |
2167 PRECORDCORE pre; | |
2168 | |
2169 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; | |
2170 if(pre) | |
2171 text = pre->pszIcon; | |
2172 } | |
2173 | |
2174 if(tmp->window == conthwnd) | |
2175 { | |
2176 result = containerselectfunc(tmp->window, text, tmp->data); | |
2177 tmp = NULL; | |
2178 } | |
2179 } | |
2180 break; | |
2181 case CN_CONTEXTMENU: | |
2182 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2183 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction; |
3 | 2184 int id = SHORT1FROMMP(mp1); |
2185 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2186 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
|
2187 void *user = NULL; |
3 | 2188 LONG x,y; |
2189 | |
2190 if(mp2) | |
2191 { | |
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
|
2192 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
|
2193 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2194 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
|
2195 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2196 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
|
2197 user = pci->user; |
3 | 2198 } |
2199 | |
2200 dw_pointer_query_pos(&x, &y); | |
2201 | |
2202 if(tmp->window == conthwnd) | |
2203 { | |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2204 int container = (int)dw_window_get_data(tmp->window, "_dw_container"); |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2205 |
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
|
2206 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
|
2207 { |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2208 if(!container) |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2209 { |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2210 NOTIFYRECORDEMPHASIS pre; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2211 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
2212 dw_tree_item_select(tmp->window, (HTREEITEM)mp2); |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2213 pre.pRecord = mp2; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2214 pre.fEmphasisMask = CRA_CURSORED; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2215 pre.hwndCnr = tmp->window; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2216 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre); |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2217 pre.pRecord->flRecordAttr |= CRA_CURSORED; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2218 } |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2219 else |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2220 { |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2221 if(pCoreEmph) |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2222 _clear_emphasis(); |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2223 hwndEmph = tmp->window; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2224 pCoreEmph = mp2; |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2225 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE)); |
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2226 } |
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
|
2227 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2228 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); |
3 | 2229 tmp = NULL; |
2230 } | |
2231 } | |
2232 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
|
2233 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
|
2234 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2235 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
|
2236 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
|
2237 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2238 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
|
2239 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2240 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
|
2241 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2242 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
|
2243 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2244 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
|
2245 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2246 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
|
2247 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2248 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
|
2249 { |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
2250 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction; |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
2251 |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2252 if(dw_window_get_data(tmp->window, "_dw_container")) |
311
24c1dfffe97e
Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
310
diff
changeset
|
2253 result = treeselectfunc(tmp->window, 0, pci->rc.pszIcon, tmp->data, 0); |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2254 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2255 { |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2256 if(lasthcnr == tmp->window && lastitem == (HWND)pci) |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2257 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2258 lasthcnr = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2259 lastitem = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2260 } |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2261 else |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2262 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2263 lasthcnr = tmp->window; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2264 lastitem = (HWND)pci; |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
2265 result = treeselectfunc(tmp->window, (HTREEITEM)pci, pci->rc.pszIcon, tmp->data, pci->user); |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2266 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2267 } |
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
|
2268 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
|
2269 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2270 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2271 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2272 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
|
2273 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2274 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2275 break; |
3 | 2276 case LN_SELECT: |
2277 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2278 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
|
2279 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2280 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
|
2281 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2282 if(strncmp(classbuf, "#38", 4) == 0) |
3 | 2283 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2284 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction; |
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 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2286 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
|
2287 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2288 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
|
2289 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
|
2290 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
|
2291 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
|
2292 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2293 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
|
2294 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
|
2295 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
|
2296 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2297 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
|
2298 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2299 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2300 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2301 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2302 int (* API listboxselectfunc)(HWND, int, void *) = (int (* API )(HWND, int, void *))tmp->signalfunction; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2303 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
|
2304 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
|
2305 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
|
2306 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2307 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) |
3 | 2308 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2309 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
|
2310 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
|
2311 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2312 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
|
2313 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2314 _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
|
2315 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2316 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
|
2317 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2318 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
|
2319 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2320 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
|
2321 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2322 /* 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
|
2323 * 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
|
2324 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2325 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
|
2326 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
|
2327 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2328 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
|
2329 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
|
2330 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2331 else |
3 | 2332 result = listboxselectfunc(tmp->window, index, tmp->data); |
2333 | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2334 _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
|
2335 tmp = NULL; |
3 | 2336 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2337 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2338 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2339 break; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2340 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
|
2341 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2342 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2343 |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2344 if(origmsg == 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
|
2345 { |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2346 /* Handle Slider control */ |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2347 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2348 { |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2349 static int lastvalue = -1; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2350 static HWND lasthwnd = NULLHANDLE; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2351 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2352 if(lastvalue != ulValue || lasthwnd != tmp->window) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2353 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2354 dw_window_set_data(tmp->window, "_dw_slider_value", (void *)ulValue); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2355 result = valuechangedfunc(tmp->window, ulValue, tmp->data); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2356 lastvalue = ulValue; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2357 lasthwnd = tmp->window; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2358 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2359 tmp = 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
|
2360 } |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2361 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2362 else |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2363 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2364 /* Handle scrollbar control */ |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2365 if(tmp->window > 65535 && tmp->window == WinWindowFromID(hWnd, (ULONG)mp1)) |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2366 { |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2367 int pos = _HandleScroller(tmp->window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));; |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2368 |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2369 if(pos > -1) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2370 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2371 dw_window_set_data(tmp->window, "_dw_scrollbar_value", (void *)pos); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2372 result = valuechangedfunc(tmp->window, pos, tmp->data); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2373 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2374 result = 0; |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2375 tmp = NULL; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
2376 } |
3 | 2377 } |
2378 } | |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2379 break; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2380 case BKN_PAGESELECTED: |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2381 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2382 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2383 |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2384 if(psn && tmp->window == psn->hwndBook) |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2385 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2386 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))tmp->signalfunction; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2387 |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2388 result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data); |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2389 tmp = NULL; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2390 } |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2391 } |
3 | 2392 break; |
2393 } | |
2394 } | |
2395 break; | |
2396 } | |
2397 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2398 |
3 | 2399 if(tmp) |
2400 tmp = tmp->next; | |
2401 | |
2402 } | |
2403 return (MRESULT)result; | |
2404 } | |
2405 | |
2406 /* Handles control messages sent to the box (owner). */ | |
2407 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2408 { | |
2409 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
2410 | |
2411 switch(msg) | |
2412 { | |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2413 case WM_VSCROLL: |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
2414 case WM_HSCROLL: |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2415 if(_run_event(hWnd, msg, mp1, mp2)) |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2416 { |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2417 HWND window = WinWindowFromID(hWnd, (ULONG)mp1); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2418 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2)); |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2419 } |
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
2420 break; |
3 | 2421 case WM_CONTROL: |
2422 _run_event(hWnd, msg, mp1, mp2); | |
2423 break; | |
2424 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2425 |
3 | 2426 if(blah && blah->oldproc) |
2427 return blah->oldproc(hWnd, msg, mp1, mp2); | |
2428 | |
2429 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2430 } | |
2431 | |
2432 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | |
2433 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2434 { | |
2435 int result = -1; | |
2436 static int command_active = 0; | |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2437 void (* API windowfunc)(PVOID) = 0L; |
3 | 2438 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
2439 if(!command_active) |
3 | 2440 { |
2441 /* Make sure we don't end up in infinite recursion */ | |
2442 command_active = 1; | |
2443 | |
2444 result = (int)_run_event(hWnd, msg, mp1, mp2); | |
2445 | |
2446 command_active = 0; | |
2447 } | |
2448 | |
2449 /* Now that any handlers are done... do normal processing */ | |
2450 switch( msg ) | |
2451 { | |
2452 case WM_ERASEBACKGROUND: | |
2453 return 0; | |
2454 | |
2455 case WM_PAINT: | |
2456 { | |
2457 HPS hps; | |
2458 RECTL rc; | |
2459 | |
2460 hps = WinBeginPaint( hWnd, 0L, &rc ); | |
2461 WinEndPaint( hps ); | |
2462 break; | |
2463 } | |
2464 | |
2465 case WM_SIZE: | |
2466 { | |
2467 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2468 | |
2469 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2)) | |
2470 return (MPARAM)TRUE; | |
2471 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2472 if(mybox && mybox->flags != DW_MINIMIZED) |
3 | 2473 { |
2474 /* Hide the window when recalculating to reduce | |
2475 * CPU load. | |
2476 */ | |
2477 WinShowWindow(hWnd, FALSE); | |
2478 | |
2479 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); | |
2480 | |
2481 WinShowWindow(hWnd, TRUE); | |
2482 } | |
2483 } | |
2484 break; | |
2485 case WM_MINMAXFRAME: | |
2486 { | |
2487 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2488 SWP *swp = (SWP *)mp1; | |
2489 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2490 if(mybox && (swp->fl & SWP_MINIMIZE)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2491 mybox->flags = DW_MINIMIZED; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2492 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2493 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
|
2494 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2495 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
|
2496 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2497 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
|
2498 } |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2499 |
3 | 2500 if(mybox && (swp->fl & SWP_MAXIMIZE)) |
2501 { | |
2502 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
|
2503 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
|
2504 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2505 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
|
2506 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2507 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
|
2508 return FALSE; |
3 | 2509 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2510 mybox->flags = 0; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2511 |
3 | 2512 /* Hide the window when recalculating to reduce |
2513 * CPU load. | |
2514 */ | |
2515 WinShowWindow(hWnd, FALSE); | |
2516 | |
2517 _do_resize(mybox, swp->cx, swp->cy); | |
2518 | |
2519 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) | |
2520 { | |
2521 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); | |
2522 | |
2523 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
|
2524 _check_resize_notebook(mybox->items[z].hwnd); |
3 | 2525 |
2526 } | |
2527 | |
2528 WinShowWindow(hWnd, TRUE); | |
2529 } | |
2530 } | |
2531 break; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2532 case WM_CONTROL: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2533 switch(SHORT2FROMMP(mp1)) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2534 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2535 case BKN_PAGESELECTEDPENDING: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2536 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2537 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2538 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
|
2539 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
|
2540 unsigned long x, y, width, height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2541 RECTL rc; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2542 |
21
c6e76b796b28
Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
20
diff
changeset
|
2543 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
|
2544 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2545 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
|
2546 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2547 rc.xLeft = x; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2548 rc.yBottom = y; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2549 rc.xRight = x + width; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2550 rc.yTop = y + height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2551 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2552 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
|
2553 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2554 _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
|
2555 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2556 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2557 break; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2558 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2559 break; |
3 | 2560 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
|
2561 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
|
2562 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2563 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
|
2564 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
|
2565 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2566 break; |
404
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2567 case WM_MOUSEMOVE: |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2568 { |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2569 HPOINTER ptr = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer"); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2570 |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2571 if(ptr) |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2572 WinSetPointer(HWND_DESKTOP, ptr); |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2573 } |
720e61df8cf6
An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
399
diff
changeset
|
2574 break; |
3 | 2575 case WM_USER: |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2576 windowfunc = (void (* API)(void *))mp1; |
3 | 2577 |
2578 if(windowfunc) | |
2579 windowfunc((void *)mp2); | |
2580 break; | |
2581 case WM_CHAR: | |
2582 if(SHORT1FROMMP(mp2) == '\t') | |
2583 { | |
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
|
2584 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
|
2585 _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
|
2586 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
|
2587 _shift_focus(hWnd); |
3 | 2588 return FALSE; |
2589 } | |
2590 break; | |
2591 case WM_DESTROY: | |
2592 /* Free memory before destroying */ | |
2593 _free_window_memory(hWnd); | |
2594 break; | |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2595 case WM_MENUEND: |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2596 _clear_emphasis(); |
183
b5a92b04b298
Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
182
diff
changeset
|
2597 break; |
3 | 2598 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2599 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2600 if(result != -1) |
3 | 2601 return (MRESULT)result; |
2602 else | |
2603 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2604 } | |
2605 | |
2606 void _changebox(Box *thisbox, int percent, int type) | |
2607 { | |
2608 int z; | |
2609 | |
2610 for(z=0;z<thisbox->count;z++) | |
2611 { | |
2612 if(thisbox->items[z].type == TYPEBOX) | |
2613 { | |
2614 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
2615 _changebox(tmp, percent, type); | |
2616 } | |
2617 else | |
2618 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2619 if(type == DW_HORZ) |
3 | 2620 { |
2621 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2622 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2623 } | |
2624 else | |
2625 { | |
2626 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2627 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2628 } | |
2629 } | |
2630 } | |
2631 } | |
2632 | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2633 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2634 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2635 if(type == DW_HORZ) |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2636 { |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2637 int newx = x; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2638 float ratio = (float)percent/(float)100.0; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2639 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2640 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2641 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2642 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2643 WinShowWindow(handle1, FALSE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2644 WinShowWindow(handle2, FALSE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2645 |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2646 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2647 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2648 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2649 _do_resize(tmp, newx - 1, y - 1); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2650 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2651 dw_window_set_data(hwnd, "_dw_start", (void *)newx); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2652 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2653 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2654 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2655 newx = x - newx - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2656 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2657 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2658 _do_resize(tmp, newx - 1, y - 1); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2659 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2660 WinShowWindow(handle1, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2661 WinShowWindow(handle2, TRUE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2662 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2663 else |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2664 { |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2665 int newy = y; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2666 float ratio = (float)percent/(float)100.0; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2667 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2668 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2669 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2670 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2671 WinShowWindow(handle1, FALSE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2672 WinShowWindow(handle2, FALSE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2673 |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2674 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2675 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2676 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2677 _do_resize(tmp, x - 1, newy - 1); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2678 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2679 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2680 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2681 newy = y - newy - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2682 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2683 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE); |
182
b8caec82a4d2
Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
180
diff
changeset
|
2684 _do_resize(tmp, x - 1, newy - 1); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2685 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2686 WinShowWindow(handle1, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2687 WinShowWindow(handle2, TRUE); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2688 |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2689 dw_window_set_data(hwnd, "_dw_start", (void *)newy); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2690 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2691 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2692 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2693 |
3 | 2694 /* This handles any activity on the splitbars (sizers) */ |
2695 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2696 { | |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
2697 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent"); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
2698 int type = (int)dw_window_get_data(hwnd, "_dw_type"); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2699 int start = (int)dw_window_get_data(hwnd, "_dw_start"); |
3 | 2700 |
2701 switch (msg) | |
2702 { | |
2703 case WM_ACTIVATE: | |
2704 case WM_SETFOCUS: | |
2705 return (MRESULT)(FALSE); | |
2706 | |
2707 case WM_PAINT: | |
2708 { | |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2709 HPS hps; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2710 POINTL ptl[2]; |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2711 RECTL rcl; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2712 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2713 hps = WinBeginPaint(hwnd, 0, 0); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2714 |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2715 WinQueryWindowRect(hwnd, &rcl); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2716 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2717 if(type == DW_HORZ) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2718 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2719 ptl[0].x = rcl.xLeft + start; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2720 ptl[0].y = rcl.yBottom; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2721 ptl[1].x = rcl.xRight + start + 3; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2722 ptl[1].y = rcl.yTop; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2723 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2724 else |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2725 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2726 ptl[0].x = rcl.xLeft; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2727 ptl[0].y = rcl.yBottom + start; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2728 ptl[1].x = rcl.xRight; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2729 ptl[1].y = rcl.yTop + start + 3; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2730 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2731 |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2732 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2733 GpiSetColor(hps, CLR_PALEGRAY); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2734 GpiMove(hps, &ptl[0]); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2735 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2736 WinEndPaint(hps); |
3 | 2737 } |
2738 return MRFROMSHORT(FALSE); | |
2739 | |
2740 case WM_MOUSEMOVE: | |
2741 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2742 if(type == DW_HORZ) |
3 | 2743 WinSetPointer(HWND_DESKTOP, |
2744 WinQuerySysPointer(HWND_DESKTOP, | |
2745 SPTR_SIZEWE, | |
2746 FALSE)); | |
2747 else | |
2748 WinSetPointer(HWND_DESKTOP, | |
2749 WinQuerySysPointer(HWND_DESKTOP, | |
2750 SPTR_SIZENS, | |
2751 FALSE)); | |
2752 } | |
2753 return MRFROMSHORT(FALSE); | |
2754 case WM_BUTTON1DOWN: | |
2755 { | |
2756 APIRET rc; | |
2757 RECTL rclFrame; | |
2758 RECTL rclBounds; | |
2759 | |
2760 WinQueryWindowRect(hwnd, &rclFrame); | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2761 WinQueryWindowRect(hwnd, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2762 |
3 | 2763 WinMapWindowPoints(hwnd, HWND_DESKTOP, |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2764 (PPOINTL)&rclBounds, 2); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2765 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2766 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2767 if(type == DW_HORZ) |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2768 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2769 rclFrame.xLeft = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2770 rclFrame.xRight = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2771 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2772 else |
3 | 2773 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2774 rclFrame.yBottom = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2775 rclFrame.yTop = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2776 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2777 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2778 if(percent) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2779 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2780 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2781 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2782 if(rc == TRUE) |
3 | 2783 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2784 int width = (rclBounds.xRight - rclBounds.xLeft); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2785 int height = (rclBounds.yTop - rclBounds.yBottom); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2786 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
2787 if(type == DW_HORZ) |
3 | 2788 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2789 start = rclFrame.xLeft - rclBounds.xLeft; |
127
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2790 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) |
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2791 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; |
3 | 2792 } |
2793 else | |
2794 { | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2795 start = rclFrame.yBottom - rclBounds.yBottom; |
127
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2796 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH) |
c5c3ccb84ac7
Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
125
diff
changeset
|
2797 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0); |
3 | 2798 } |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2799 _handle_splitbar_resize(hwnd, *percent, type, width, height); |
3 | 2800 } |
2801 } | |
2802 } | |
2803 return MRFROMSHORT(FALSE); | |
2804 } | |
2805 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2806 } | |
2807 | |
2808 /* Function: BubbleProc | |
2809 * Abstract: Subclass procedure for bubble help | |
2810 */ | |
2811 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2812 { | |
2813 MRESULT res; | |
2814 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
2815 | |
2816 if(proc) | |
2817 res = proc(hwnd, msg, mp1, mp2); | |
2818 else | |
2819 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2820 | |
2821 if(msg == WM_PAINT) | |
2822 { | |
2823 POINTL ptl; | |
2824 HPS hpsTemp; | |
2825 RECTL rcl; | |
2826 int height, width; | |
2827 | |
2828 WinQueryWindowRect(hwnd, &rcl); | |
2829 height = rcl.yTop - rcl.yBottom - 1; | |
2830 width = rcl.xRight - rcl.xLeft - 1; | |
2831 | |
2832 /* Draw a border around the bubble help */ | |
2833 hpsTemp = WinGetPS(hwnd); | |
230
15810221d4ea
Don't use DW_CLR_* when making direct OS/2 API calls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
228
diff
changeset
|
2834 GpiSetColor(hpsTemp, CLR_BLACK); |
3 | 2835 ptl.x = ptl.y = 0; |
2836 GpiMove(hpsTemp, &ptl); | |
2837 ptl.x = 0; | |
2838 ptl.y = height; | |
2839 GpiLine(hpsTemp, &ptl); | |
2840 ptl.x = ptl.y = 0; | |
2841 GpiMove(hpsTemp, &ptl); | |
2842 ptl.y = 0; | |
2843 ptl.x = width; | |
2844 GpiLine(hpsTemp, &ptl); | |
2845 ptl.x = width; | |
2846 ptl.y = height; | |
2847 GpiMove(hpsTemp, &ptl); | |
2848 ptl.x = 0; | |
2849 ptl.y = height; | |
2850 GpiLine(hpsTemp, &ptl); | |
2851 ptl.x = width; | |
2852 ptl.y = height; | |
2853 GpiMove(hpsTemp, &ptl); | |
2854 ptl.y = 0; | |
2855 ptl.x = width; | |
2856 GpiLine(hpsTemp, &ptl); | |
2857 WinReleasePS(hpsTemp); | |
2858 } | |
2859 return res; | |
2860 } | |
2861 | |
366
4ed3b13ee48c
Code to do the OS/2 style indent when the button is pressed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
365
diff
changeset
|
2862 MRESULT EXPENTRY _button_draw(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, PFNWP oldproc, int indent) |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2863 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2864 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap"); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2865 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled"); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2866 MRESULT res; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2867 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2868 if(!oldproc) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2869 res = WinDefWindowProc(hwnd, msg, mp1, mp2); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2870 res = oldproc(hwnd, msg, mp1, mp2); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2871 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2872 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2873 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2874 unsigned long width, height; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2875 int x, y; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2876 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2877 dw_window_get_pos_size(hwnd, NULL, NULL, &width, &height); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2878 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2879 x = (width - pixmap->width)/2; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2880 y = (height - pixmap->height)/2; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2881 |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2882 if(disable && dw_window_get_data(hwnd, "_dw_disabled")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2883 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, disable, 0, 0); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2884 else |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2885 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, pixmap, 0, 0); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2886 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2887 return res; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2888 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2889 |
3 | 2890 /* Function: BtProc |
2891 * Abstract: Subclass procedure for buttons | |
2892 */ | |
2893 | |
2894 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2895 { | |
2896 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
|
2897 PFNWP oldproc; |
3 | 2898 |
2899 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER); | |
2900 | |
2901 if(!bubble) | |
2902 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2903 | |
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
|
2904 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
|
2905 |
3 | 2906 switch(msg) |
2907 { | |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
2908 case WM_PAINT: |
366
4ed3b13ee48c
Code to do the OS/2 style indent when the button is pressed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
365
diff
changeset
|
2909 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2910 case BM_SETHILITE: |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2911 return _button_draw(hwnd, msg, mp1, mp2, oldproc, (int)mp1); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2912 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
|
2913 if(mp2) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2914 _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
|
2915 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2916 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
2917 break; |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2918 case WM_BUTTON1DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2919 case WM_BUTTON2DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2920 case WM_BUTTON3DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2921 case WM_BUTTON1DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2922 case WM_BUTTON2DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2923 case WM_BUTTON3DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2924 if(dw_window_get_data(hwnd, "_dw_disabled")) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2925 return (MRESULT)FALSE; |
368
72fbd1ee8150
Ug, missed a break statement.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
367
diff
changeset
|
2926 break; |
3 | 2927 case WM_BUTTON1UP: |
2928 { | |
2929 SignalHandler *tmp = Root; | |
2930 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
2931 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled")) |
3 | 2932 { |
2933 /* Find any callbacks for this function */ | |
2934 while(tmp) | |
2935 { | |
2936 if(tmp->message == WM_COMMAND) | |
2937 { | |
2938 /* Make sure it's the right window, and the right ID */ | |
2939 if(tmp->window == hwnd) | |
2940 { | |
2941 /* Due to the fact that if we run the function | |
2942 * here, finishing actions on the button will occur | |
2943 * after we run the signal handler. So we post the | |
2944 * message so the button can finish what it needs to | |
2945 * do before we run our handler. | |
2946 */ | |
2947 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2948 tmp = NULL; | |
2949 } | |
2950 } | |
2951 if(tmp) | |
2952 tmp= tmp->next; | |
2953 } | |
2954 } | |
2955 } | |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
2956 break; |
3 | 2957 case WM_USER: |
2958 { | |
2959 SignalHandler *tmp = (SignalHandler *)mp1; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2960 int (* API clickfunc)(HWND, void *) = NULL; |
3 | 2961 |
2962 if(tmp) | |
2963 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2964 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2965 |
2966 clickfunc(tmp->window, tmp->data); | |
2967 } | |
2968 } | |
2969 break; | |
2970 case WM_CHAR: | |
2971 { | |
2972 /* A button press should also occur for an ENTER or SPACE press | |
2973 * while the button has the active input focus. | |
2974 */ | |
2975 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') | |
2976 { | |
2977 SignalHandler *tmp = Root; | |
2978 | |
2979 /* Find any callbacks for this function */ | |
2980 while(tmp) | |
2981 { | |
2982 if(tmp->message == WM_COMMAND) | |
2983 { | |
2984 /* Make sure it's the right window, and the right ID */ | |
2985 if(tmp->window == hwnd) | |
2986 { | |
2987 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
2988 tmp = NULL; | |
2989 } | |
2990 } | |
2991 if(tmp) | |
2992 tmp= tmp->next; | |
2993 } | |
2994 } | |
2995 if(SHORT1FROMMP(mp2) == '\t') | |
2996 { | |
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
|
2997 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
|
2998 _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
|
2999 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
|
3000 _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
|
3001 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
|
3002 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
|
3003 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3004 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
|
3005 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3006 _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
|
3007 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
|
3008 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3009 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
|
3010 { |
3 | 3011 _shift_focus(hwnd); |
3012 return FALSE; | |
3013 } | |
3014 } | |
3015 break; | |
3016 case 0x041f: | |
3017 if (hwndBubble) | |
3018 { | |
3019 WinDestroyWindow(hwndBubble); | |
3020 hwndBubble = 0; | |
3021 } | |
3022 break; | |
3023 | |
3024 case 0x041e: | |
3025 | |
3026 if(!*bubble->bubbletext) | |
3027 break; | |
3028 | |
3029 if(hwndBubble) | |
3030 { | |
3031 WinDestroyWindow(hwndBubble); | |
3032 hwndBubble = 0; | |
3033 } | |
3034 | |
3035 if(!hwndBubble) | |
3036 { | |
3037 HPS hpsTemp = 0; | |
3038 LONG lHight; | |
3039 LONG lWidth; | |
3040 POINTL txtPointl[TXTBOX_COUNT]; | |
3041 POINTL ptlWork = {0,0}; | |
230
15810221d4ea
Don't use DW_CLR_* when making direct OS/2 API calls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
228
diff
changeset
|
3042 ULONG ulColor = CLR_YELLOW; |
3 | 3043 void *blah; |
3044 | |
3045 hwndBubbleLast = hwnd; | |
3046 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
3047 WC_STATIC, | |
3048 "", | |
3049 SS_TEXT | | |
3050 DT_CENTER | | |
3051 DT_VCENTER, | |
3052 0,0,0,0, | |
3053 HWND_DESKTOP, | |
3054 HWND_TOP, | |
3055 0, | |
3056 NULL, | |
3057 NULL); | |
3058 | |
3059 WinSetPresParam(hwndBubble, | |
3060 PP_FONTNAMESIZE, | |
363
eaebef97fc4f
Fixed using the default font in the bubble help.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
360
diff
changeset
|
3061 strlen(DefaultFont)+1, |
3 | 3062 DefaultFont); |
3063 | |
3064 | |
3065 WinSetPresParam(hwndBubble, | |
3066 PP_BACKGROUNDCOLORINDEX, | |
3067 sizeof(ulColor), | |
3068 &ulColor); | |
3069 | |
3070 WinSetWindowText(hwndBubble, | |
3071 bubble->bubbletext); | |
3072 | |
3073 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
3074 | |
3075 hpsTemp = WinGetPS(hwndBubble); | |
3076 GpiQueryTextBox(hpsTemp, | |
3077 strlen(bubble->bubbletext), | |
3078 bubble->bubbletext, | |
3079 TXTBOX_COUNT, | |
3080 txtPointl); | |
3081 WinReleasePS(hpsTemp); | |
3082 | |
3083 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
3084 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
3085 | |
3086 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
3087 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
3088 | |
3089 ptlWork.y -= lHight; | |
3090 | |
3091 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
3092 | |
3093 if(blah) | |
3094 WinSetWindowPtr(hwndBubble, QWP_USER, blah); | |
3095 | |
3096 WinSetWindowPos(hwndBubble, | |
3097 HWND_TOP, | |
3098 ptlWork.x, | |
3099 ptlWork.y, | |
3100 lWidth, | |
3101 lHight, | |
3102 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
3103 } | |
3104 break; | |
3105 } | |
3106 | |
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
|
3107 if(!oldproc) |
3 | 3108 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
|
3109 return oldproc(hwnd, msg, mp1, mp2); |
3 | 3110 } |
3111 | |
3112 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
3113 { | |
3114 int res = 0; | |
3115 res = (int)_run_event(hwnd, msg, mp1, mp2); | |
3116 switch(msg) | |
3117 { | |
3118 case WM_BUTTON1DOWN: | |
3119 case WM_BUTTON2DOWN: | |
3120 case WM_BUTTON3DOWN: | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3121 if(res == -1) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3122 WinSetFocus(HWND_DESKTOP, hwnd); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3123 else if(res) |
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
|
3124 return (MPARAM)TRUE; |
3 | 3125 } |
3126 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
3127 } | |
3128 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3129 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
|
3130 { |
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
|
3131 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
|
3132 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
|
3133 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3134 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
|
3135 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
|
3136 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3137 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
|
3138 { |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3139 case WM_PAINT: |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3140 { |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3141 HPS hps; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3142 RECTL rcl; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3143 POINTL ptl[2]; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3144 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3145 if(oldproc) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
3146 oldproc(hwnd, msg, mp1, mp2); |
128
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3147 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3148 hps = WinBeginPaint(hwnd, 0, 0); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3149 WinQueryWindowRect(hwnd, &rcl); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3150 ptl[0].x = rcl.xLeft + 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3151 ptl[0].y = rcl.yBottom + 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3152 ptl[1].x = rcl.xRight - 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3153 ptl[1].y = rcl.yTop - 1; |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3154 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3155 GpiSetColor(hps, CLR_BLACK); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3156 GpiMove(hps, &ptl[0]); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3157 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3158 WinEndPaint(hps); |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3159 } |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3160 return MRFROMSHORT(FALSE); |
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
|
3161 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
|
3162 _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
|
3163 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
|
3164 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
|
3165 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
|
3166 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3167 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
|
3168 _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
|
3169 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
|
3170 _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
|
3171 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
|
3172 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3173 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
|
3174 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3175 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3176 _run_event(hwnd, msg, mp1, mp2); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
3177 |
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
|
3178 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
|
3179 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
|
3180 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3181 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3182 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3183 |
3 | 3184 /* |
3185 * Initializes the Dynamic Windows engine. | |
3186 * Parameters: | |
3187 * newthread: True if this is the only thread. | |
3188 * False if there is already a message loop running. | |
3189 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3190 int API dw_init(int newthread, int argc, char *argv[]) |
3 | 3191 { |
3192 APIRET rc; | |
3193 | |
3194 if(newthread) | |
3195 { | |
3196 dwhab = WinInitialize(0); | |
3197 dwhmq = WinCreateMsgQueue(dwhab, 0); | |
3198 } | |
3199 | |
3200 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | |
3201 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); | |
3202 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3203 /* Get the OS/2 version. */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3204 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
|
3205 |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3206 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); |
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3207 |
360
cf66410d03b4
Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
356
diff
changeset
|
3208 if(!IS_WARP4()) |
cf66410d03b4
Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
356
diff
changeset
|
3209 DefaultFont = "8.Helv"; |
3 | 3210 return rc; |
3211 } | |
3212 | |
3213 /* | |
3214 * Runs a message loop for Dynamic Windows. | |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3215 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3216 void API dw_main(void) |
3 | 3217 { |
3218 QMSG qmsg; | |
3219 | |
3220 _dwtid = dw_thread_id(); | |
3221 | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3222 while(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3223 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3224 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3225 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3226 WinDispatchMsg(dwhab, &qmsg); |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3227 } |
3 | 3228 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3229 WinDestroyMsgQueue(dwhmq); |
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3230 WinTerminate(dwhab); |
3 | 3231 } |
3232 | |
3233 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3234 * 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
|
3235 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3236 * 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
|
3237 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3238 void API dw_main_sleep(int milliseconds) |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3239 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3240 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
|
3241 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
|
3242 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3243 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
|
3244 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3245 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
|
3246 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3247 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3248 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3249 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3250 WinDispatchMsg(dwhab, &qmsg); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3251 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3252 else |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3253 DosSleep(1); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3254 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3255 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3256 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3257 /* |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3258 * Processes a single message iteration and returns. |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3259 */ |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3260 void API dw_main_iteration(void) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3261 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3262 QMSG qmsg; |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3263 |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3264 _dwtid = dw_thread_id(); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3265 |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3266 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3267 { |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3268 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3269 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3270 WinDispatchMsg(dwhab, &qmsg); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3271 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3272 } |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3273 |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
3274 /* |
3 | 3275 * Free's memory allocated by dynamic windows. |
3276 * Parameters: | |
3277 * ptr: Pointer to dynamic windows allocated | |
3278 * memory to be free()'d. | |
3279 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3280 void API dw_free(void *ptr) |
3 | 3281 { |
3282 free(ptr); | |
3283 } | |
3284 | |
3285 /* | |
3286 * Allocates and initializes a dialog struct. | |
3287 * Parameters: | |
3288 * data: User defined data to be passed to functions. | |
3289 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3290 DWDialog * API dw_dialog_new(void *data) |
3 | 3291 { |
3292 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
3293 | |
3294 tmp->eve = dw_event_new(); | |
3295 dw_event_reset(tmp->eve); | |
3296 tmp->data = data; | |
3297 tmp->done = FALSE; | |
3298 tmp->result = NULL; | |
3299 | |
3300 return tmp; | |
3301 } | |
3302 | |
3303 /* | |
3304 * Accepts a dialog struct and returns the given data to the | |
3305 * initial called of dw_dialog_wait(). | |
3306 * Parameters: | |
3307 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3308 * result: Data to be returned by dw_dialog_wait(). | |
3309 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3310 int API dw_dialog_dismiss(DWDialog *dialog, void *result) |
3 | 3311 { |
3312 dialog->result = result; | |
3313 dw_event_post(dialog->eve); | |
3314 dialog->done = TRUE; | |
3315 return 0; | |
3316 } | |
3317 | |
3318 /* | |
3319 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
3320 * called by a signal handler with the given dialog struct. | |
3321 * Parameters: | |
3322 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3323 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3324 void * API dw_dialog_wait(DWDialog *dialog) |
3 | 3325 { |
3326 QMSG qmsg; | |
3327 void *tmp; | |
3328 | |
3329 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | |
3330 { | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3331 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3332 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
3 | 3333 WinDispatchMsg(dwhab, &qmsg); |
3334 if(dialog->done) | |
3335 break; | |
3336 } | |
3337 dw_event_close(&dialog->eve); | |
3338 tmp = dialog->result; | |
3339 free(dialog); | |
3340 return tmp; | |
3341 } | |
3342 | |
3343 | |
3344 /* | |
3345 * Displays a Message Box with given text and title.. | |
3346 * Parameters: | |
3347 * title: The title of the message box. | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3348 * flags: flags to indicate buttons and icon |
3 | 3349 * format: printf style format string. |
3350 * ...: Additional variables for use in the format. | |
3351 */ | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3352 int API dw_messagebox(char *title, int flags, char *format, ...) |
3 | 3353 { |
3354 va_list args; | |
3355 char outbuf[1024]; | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3356 int rc; |
3 | 3357 |
3358 va_start(args, format); | |
3359 vsprintf(outbuf, format, args); | |
3360 va_end(args); | |
3361 | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3362 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, flags | MB_MOVEABLE | MB_SYSTEMMODAL); |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3363 if(rc == MBID_OK) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3364 return DW_MB_RETURN_OK; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3365 else if(rc == MBID_YES) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3366 return DW_MB_RETURN_YES; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3367 else if(rc == MBID_NO) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3368 return DW_MB_RETURN_NO; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3369 else if(rc == MBID_CANCEL) |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3370 return DW_MB_RETURN_CANCEL; |
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3371 else return 0; |
3 | 3372 } |
3373 | |
3374 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3375 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3376 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3377 * 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
|
3378 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3379 int API dw_window_raise(HWND handle) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3380 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3381 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
|
3382 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3383 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3384 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3385 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3386 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3387 * 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
|
3388 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3389 int API dw_window_lower(HWND handle) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3390 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3391 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
|
3392 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3393 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3394 /* |
3 | 3395 * Makes the window visible. |
3396 * Parameters: | |
3397 * handle: The window handle to make visible. | |
3398 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3399 int API dw_window_show(HWND handle) |
3 | 3400 { |
3401 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW); | |
3402 HSWITCH hswitch; | |
3403 SWCNTRL swcntrl; | |
3404 | |
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
|
3405 _fix_button_owner(_toplevel_window(handle), 0); |
3 | 3406 WinSetFocus(HWND_DESKTOP, handle); |
3407 _initial_focus(handle); | |
3408 | |
3409 /* If this window has a switch list entry make sure it is visible */ | |
3410 hswitch = WinQuerySwitchHandle(handle, 0); | |
3411 if(hswitch) | |
3412 { | |
3413 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3414 swcntrl.uchVisibility = SWL_VISIBLE; | |
3415 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3416 } | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3417 if(WinWindowFromID(handle, FID_CLIENT)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3418 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3419 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3420 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3421 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
|
3422 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3423 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
|
3424 int newx, newy, changed = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3425 SWP swp; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3426 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3427 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3428 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3429 WinQueryWindowPos(handle, &swp); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3430 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3431 newx = swp.x; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3432 newy = swp.y; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3433 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3434 if((swp.x+swp.cx) > cx) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3435 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3436 newx = (cx - swp.cx)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3437 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3438 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3439 if((swp.y+swp.cy) > cy) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3440 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3441 newy = (cy - swp.cy)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3442 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3443 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3444 if(changed) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3445 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
|
3446 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3447 } |
3 | 3448 return rc; |
3449 } | |
3450 | |
3451 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3452 * 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
|
3453 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3454 * handle: The window handle to minimize. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3455 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3456 int API dw_window_minimize(HWND handle) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3457 { |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3458 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
|
3459 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3460 if(hwndclient) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3461 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3462 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
|
3463 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3464 if(box) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3465 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3466 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
|
3467 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
|
3468 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3469 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3470 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3471 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
|
3472 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3473 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3474 /* |
3 | 3475 * Makes the window invisible. |
3476 * Parameters: | |
3477 * handle: The window handle to make visible. | |
3478 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3479 int API dw_window_hide(HWND handle) |
3 | 3480 { |
3481 HSWITCH hswitch; | |
3482 SWCNTRL swcntrl; | |
3483 | |
3484 /* If this window has a switch list entry make sure it is invisible */ | |
3485 hswitch = WinQuerySwitchHandle(handle, 0); | |
3486 if(hswitch) | |
3487 { | |
3488 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3489 swcntrl.uchVisibility = SWL_INVISIBLE; | |
3490 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3491 } | |
3492 return WinShowWindow(handle, FALSE); | |
3493 } | |
3494 | |
3495 /* | |
3496 * Destroys a window and all of it's children. | |
3497 * Parameters: | |
3498 * handle: The window handle to destroy. | |
3499 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3500 int API dw_window_destroy(HWND handle) |
3 | 3501 { |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
3502 HWND frame, parent = WinQueryWindow(handle, QW_PARENT); |
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
|
3503 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
|
3504 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3505 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
|
3506 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
|
3507 |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
3508 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
3509 |
210
b9c7b762c104
When comparing the desktop value, use the queried value not the constant.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
207
diff
changeset
|
3510 if(parent != desktop && thisbox && thisbox->count) |
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
|
3511 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3512 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
|
3513 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
|
3514 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3515 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
|
3516 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3517 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
|
3518 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
|
3519 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3520 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3521 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
|
3522 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
|
3523 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3524 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
|
3525 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3526 /* 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
|
3527 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
|
3528 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3529 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
|
3530 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3531 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
|
3532 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3533 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
|
3534 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3535 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3536 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
|
3537 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
|
3538 thisbox->count--; |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
3539 _free_window_memory(frame ? frame : handle); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3540 } |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
3541 return WinDestroyWindow(frame ? frame : handle); |
3 | 3542 } |
3543 | |
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
|
3544 /* 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
|
3545 * 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
|
3546 * 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
|
3547 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3548 void API dw_window_redraw(HWND handle) |
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
|
3549 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3550 HWND client = WinWindowFromID(handle, FID_CLIENT); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3551 HWND window = client ? client : handle; |
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
|
3552 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
|
3553 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3554 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
|
3555 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3556 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
|
3557 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3558 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
|
3559 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3560 WinShowWindow(client ? mybox->items[0].hwnd : handle, FALSE); |
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
|
3561 _do_resize(mybox, width, height); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3562 WinShowWindow(client ? mybox->items[0].hwnd : handle, TRUE); |
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
|
3563 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3564 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3565 |
3 | 3566 /* |
3567 * Changes a window's parent to newparent. | |
3568 * Parameters: | |
3569 * handle: The window handle to destroy. | |
3570 * newparent: The window's new parent window. | |
3571 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3572 void API dw_window_reparent(HWND handle, HWND newparent) |
3 | 3573 { |
3574 HWND blah = WinWindowFromID(newparent, FID_CLIENT); | |
3575 WinSetParent(handle, blah ? blah : newparent, TRUE); | |
3576 } | |
3577 | |
3578 /* | |
3579 * Sets the font used by a specified window (widget) handle. | |
3580 * Parameters: | |
3581 * handle: The window (widget) handle. | |
3582 * fontname: Name and size of the font in the form "size.fontname" | |
3583 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3584 int API dw_window_set_font(HWND handle, char *fontname) |
3 | 3585 { |
3586 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | |
3587 } | |
3588 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3589 /* Internal version */ |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3590 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
3 | 3591 { |
3592 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3593 { | |
3594 RGB2 rgb2; | |
3595 | |
3596 rgb2.bBlue = DW_BLUE_VALUE(fore); | |
3597 rgb2.bGreen = DW_GREEN_VALUE(fore); | |
3598 rgb2.bRed = DW_RED_VALUE(fore); | |
3599 rgb2.fcOptions = 0; | |
3600 | |
3601 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3602 | |
3603 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3604 else if(fore != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3605 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
3606 fore = _internal_color(fore); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3607 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3608 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3609 } |
3 | 3610 if((back & DW_RGB_COLOR) == DW_RGB_COLOR) |
3611 { | |
3612 RGB2 rgb2; | |
3613 | |
3614 rgb2.bBlue = DW_BLUE_VALUE(back); | |
3615 rgb2.bGreen = DW_GREEN_VALUE(back); | |
3616 rgb2.bRed = DW_RED_VALUE(back); | |
3617 rgb2.fcOptions = 0; | |
3618 | |
3619 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3620 return 0; | |
3621 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3622 else if(back != DW_CLR_DEFAULT) |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3623 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
3624 back = _internal_color(back); |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3625 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3626 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back); |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3627 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3628 return 0; |
3 | 3629 } |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3630 /* |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3631 * Sets the colors used by a specified window (widget) handle. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3632 * Parameters: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3633 * handle: The window (widget) handle. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3634 * fore: Foreground color in DW_RGB format or a default color index. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3635 * back: Background color in DW_RGB format or a default color index. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3636 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3637 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3638 { |
228
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
3639 dw_window_set_data(handle, "_dw_fore", (void *)(fore+1)); |
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
3640 dw_window_set_data(handle, "_dw_back", (void *)(back+1)); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3641 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3642 return _dw_window_set_color(handle, fore, back); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3643 } |
3 | 3644 |
3645 /* | |
3646 * Sets the font used by a specified window (widget) handle. | |
3647 * Parameters: | |
3648 * handle: The window (widget) handle. | |
3649 * border: Size of the window border in pixels. | |
3650 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3651 int API dw_window_set_border(HWND handle, int border) |
3 | 3652 { |
3653 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border)); | |
3654 return 0; | |
3655 } | |
3656 | |
3657 /* | |
3658 * Captures the mouse input to this window. | |
3659 * Parameters: | |
3660 * handle: Handle to receive mouse input. | |
3661 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3662 void API dw_window_capture(HWND handle) |
3 | 3663 { |
3664 WinSetCapture(HWND_DESKTOP, handle); | |
3665 } | |
3666 | |
3667 /* | |
3668 * Releases previous mouse capture. | |
3669 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3670 void API dw_window_release(void) |
3 | 3671 { |
3672 WinSetCapture(HWND_DESKTOP, NULLHANDLE); | |
3673 } | |
3674 | |
3675 /* | |
3676 * Tracks this window movement. | |
3677 * Parameters: | |
3678 * handle: Handle to frame to be tracked. | |
3679 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3680 void API dw_window_track(HWND handle) |
3 | 3681 { |
3682 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0); | |
3683 } | |
3684 | |
3685 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3686 * 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
|
3687 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3688 * 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
|
3689 * 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
|
3690 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3691 void API dw_window_pointer(HWND handle, int pointertype) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3692 { |
418
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3693 if(handle == HWND_DESKTOP) |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3694 WinSetPointer(handle, WinQuerySysPointer(HWND_DESKTOP,pointertype, FALSE)); |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3695 else |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3696 dw_window_set_data(handle, "_dw_pointer", |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3697 pointertype < 65535 ? |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3698 (void *)WinQuerySysPointer(HWND_DESKTOP,pointertype, FALSE) |
4be57ee7e006
Fix a crash in dw_window_pointer when the window handle is HWND_DESKTOP.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
416
diff
changeset
|
3699 : (void *)pointertype); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3700 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3701 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3702 /* |
3 | 3703 * Create a new Window Frame. |
3704 * Parameters: | |
3705 * owner: The Owner's window handle or HWND_DESKTOP. | |
3706 * title: The Window title. | |
3707 * flStyle: Style flags, see the PM reference. | |
3708 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3709 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) |
3 | 3710 { |
3711 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
|
3712 Box *newbox = calloc(1, sizeof(Box)); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3713 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 3714 |
3715 newbox->pad = 0; | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
3716 newbox->type = DW_VERT; |
3 | 3717 newbox->count = 0; |
3718 | |
3719 flStyle |= FCF_NOBYTEALIGN; | |
3720 | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3721 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
|
3722 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
|
3723 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3724 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
|
3725 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3726 if(!(flStyle & FCF_SHELLPOSITION)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3727 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3728 |
3 | 3729 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
|
3730 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
|
3731 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
|
3732 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3733 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); |
3 | 3734 WinSetWindowPtr(hwndframe, QWP_USER, blah); |
3735 WinSetWindowPtr(hwndclient, QWP_USER, newbox); | |
3736 | |
3737 return hwndframe; | |
3738 } | |
3739 | |
3740 /* | |
3741 * Create a new Box to be packed. | |
3742 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
3743 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3744 * pad: Number of pixels to pad around the box. |
3745 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3746 HWND API dw_box_new(int type, int pad) |
3 | 3747 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3748 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3749 HWND hwndframe; |
3750 | |
3751 newbox->pad = pad; | |
3752 newbox->type = type; | |
3753 newbox->count = 0; | |
3754 newbox->grouphwnd = NULLHANDLE; | |
3755 | |
3756 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3757 WC_FRAME, | |
3758 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
|
3759 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
|
3760 FS_NOBYTEALIGN, |
3 | 3761 0,0,2000,1000, |
3762 NULLHANDLE, | |
3763 HWND_TOP, | |
3764 0L, | |
3765 NULL, | |
3766 NULL); | |
3767 | |
3768 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc); | |
3769 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3770 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3771 return hwndframe; | |
3772 } | |
3773 | |
3774 /* | |
3775 * Create a new Group Box to be packed. | |
3776 * Parameters: | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
3777 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3778 * pad: Number of pixels to pad around the box. |
3779 * title: Text to be displayined in the group outline. | |
3780 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3781 HWND API dw_groupbox_new(int type, int pad, char *title) |
3 | 3782 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3783 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3784 HWND hwndframe; |
3785 | |
3786 newbox->pad = pad; | |
3787 newbox->type = type; | |
3788 newbox->count = 0; | |
3789 | |
3790 hwndframe = WinCreateWindow(HWND_OBJECT, | |
3791 WC_FRAME, | |
3792 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
|
3793 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
|
3794 FS_NOBYTEALIGN, |
3 | 3795 0,0,2000,1000, |
3796 NULLHANDLE, | |
3797 HWND_TOP, | |
3798 0L, | |
3799 NULL, | |
3800 NULL); | |
3801 | |
3802 newbox->grouphwnd = WinCreateWindow(hwndframe, | |
3803 WC_STATIC, | |
3804 title, | |
3805 WS_VISIBLE | SS_GROUPBOX | | |
3806 WS_GROUP, | |
3807 0,0,2000,1000, | |
3808 NULLHANDLE, | |
3809 HWND_TOP, | |
3810 0L, | |
3811 NULL, | |
3812 NULL); | |
3813 | |
3814 WinSetWindowPtr(hwndframe, QWP_USER, newbox); | |
3815 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | |
3816 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
3817 dw_window_set_font(newbox->grouphwnd, DefaultFont); | |
3818 return hwndframe; | |
3819 } | |
3820 | |
3821 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3822 * 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
|
3823 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3824 * 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
|
3825 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3826 HWND API dw_mdi_new(unsigned long id) |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3827 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3828 HWND hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3829 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3830 hwndframe = WinCreateWindow(HWND_OBJECT, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3831 WC_FRAME, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3832 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
|
3833 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
|
3834 FS_NOBYTEALIGN, |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3835 0,0,2000,1000, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3836 NULLHANDLE, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3837 HWND_TOP, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3838 0L, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3839 NULL, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3840 NULL); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3841 return hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3842 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3843 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3844 /* |
3 | 3845 * Create a bitmap object to be packed. |
3846 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
3847 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 3848 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3849 HWND API dw_bitmap_new(ULONG id) |
3 | 3850 { |
3851 return WinCreateWindow(HWND_OBJECT, | |
3852 WC_STATIC, | |
3853 NULL, | |
3854 WS_VISIBLE | SS_TEXT, | |
3855 0,0,2000,1000, | |
3856 NULLHANDLE, | |
3857 HWND_TOP, | |
3858 id, | |
3859 NULL, | |
3860 NULL); | |
3861 } | |
3862 | |
3863 /* | |
3864 * Create a notebook object to be packed. | |
3865 * Parameters: | |
3866 * id: An ID to be used for getting the resource from the | |
3867 * resource file. | |
3868 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3869 HWND API dw_notebook_new(ULONG id, int top) |
3 | 3870 { |
3871 ULONG flags; | |
3872 HWND tmp; | |
3873 | |
3874 if(top) | |
3875 flags = BKS_MAJORTABTOP; | |
3876 else | |
3877 flags = BKS_MAJORTABBOTTOM; | |
3878 | |
3879 tmp = WinCreateWindow(HWND_OBJECT, | |
3880 WC_NOTEBOOK, | |
3881 NULL, | |
3882 WS_VISIBLE | | |
3883 BKS_TABBEDDIALOG | | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
3884 flags, |
3 | 3885 0,0,2000,1000, |
3886 NULLHANDLE, | |
3887 HWND_TOP, | |
3888 id, | |
3889 NULL, | |
3890 NULL); | |
3891 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3892 /* Fix tab sizes on Warp 3 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3893 if(!IS_WARP4()) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3894 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3895 /* 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
|
3896 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
|
3897 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3898 |
3 | 3899 dw_window_set_font(tmp, DefaultFont); |
3900 return tmp; | |
3901 } | |
3902 | |
3903 /* | |
3904 * Create a menu object to be popped up. | |
3905 * Parameters: | |
3906 * id: An ID to be used for getting the resource from the | |
3907 * resource file. | |
3908 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3909 HMENUI API dw_menu_new(ULONG id) |
3 | 3910 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3911 HMENUI tmp = WinCreateWindow(HWND_OBJECT, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3912 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3913 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3914 WS_VISIBLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3915 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3916 NULLHANDLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3917 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3918 id, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3919 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3920 NULL); |
3 | 3921 return tmp; |
3922 } | |
3923 | |
3924 /* | |
3925 * Create a menubar on a window. | |
3926 * Parameters: | |
3927 * location: Handle of a window frame to be attached to. | |
3928 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3929 HMENUI API dw_menubar_new(HWND location) |
3 | 3930 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3931 HMENUI tmp = WinCreateWindow(location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3932 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3933 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3934 WS_VISIBLE | MS_ACTIONBAR, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3935 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3936 location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3937 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3938 FID_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3939 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3940 NULL); |
3 | 3941 return tmp; |
3942 } | |
3943 | |
3944 /* | |
3945 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
3946 * Parameters: | |
3947 * menu: Handle of a menu. | |
3948 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3949 void API dw_menu_destroy(HMENUI *menu) |
3 | 3950 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3951 if(menu) |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3952 WinDestroyWindow(*menu); |
3 | 3953 } |
3954 | |
3955 /* | |
3956 * Adds a menuitem or submenu to an existing menu. | |
3957 * Parameters: | |
3958 * menu: The handle the the existing menu. | |
3959 * title: The title text on the menu item to be added. | |
3960 * id: An ID to be used for message passing. | |
3961 * flags: Extended attributes to set on the menu. | |
3962 * end: If TRUE memu is positioned at the end of the menu. | |
3963 * check: If TRUE menu is "check"able. | |
3964 * submenu: Handle to an existing menu to be a submenu or NULL. | |
3965 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3966 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) |
3 | 3967 { |
3968 MENUITEM miSubMenu; | |
3969 | |
3970 if(!menux) | |
3971 return NULLHANDLE; | |
3972 | |
3973 if(end) | |
3974 miSubMenu.iPosition=MIT_END; | |
3975 else | |
3976 miSubMenu.iPosition=0; | |
3977 | |
3978 if(strlen(title) == 0) | |
3979 miSubMenu.afStyle=MIS_SEPARATOR | flags; | |
3980 else | |
3981 miSubMenu.afStyle=MIS_TEXT | flags; | |
3982 miSubMenu.afAttribute=0; | |
3983 miSubMenu.id=id; | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3984 miSubMenu.hwndSubMenu = submenu; |
3 | 3985 miSubMenu.hItem=NULLHANDLE; |
3986 | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
3987 WinSendMsg(menux, |
3 | 3988 MM_INSERTITEM, |
3989 MPFROMP(&miSubMenu), | |
3990 MPFROMP(title)); | |
3991 return (HWND)id; | |
3992 } | |
3993 | |
3994 /* | |
3995 * Sets the state of a menu item check. | |
3996 * Parameters: | |
3997 * menu: The handle the the existing menu. | |
3998 * id: Menuitem id. | |
3999 * check: TRUE for checked FALSE for not checked. | |
4000 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4001 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check) |
3 | 4002 { |
4003 if(check) | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4004 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 4005 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)); |
4006 else | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4007 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 4008 MPFROM2SHORT(MIA_CHECKED, 0)); |
4009 } | |
4010 | |
4011 /* | |
4012 * Pops up a context menu at given x and y coordinates. | |
4013 * Parameters: | |
4014 * menu: The handle the the existing menu. | |
4015 * parent: Handle to the window initiating the popup. | |
4016 * x: X coordinate. | |
4017 * y: Y coordinate. | |
4018 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4019 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
3 | 4020 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4021 if(menu) |
3 | 4022 { |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
4023 popup = parent; |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4024 WinPopupMenu(HWND_DESKTOP, parent, *menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN); |
3 | 4025 } |
4026 } | |
4027 | |
4028 /* | |
4029 * Returns the current X and Y coordinates of the mouse pointer. | |
4030 * Parameters: | |
4031 * x: Pointer to variable to store X coordinate. | |
4032 * y: Pointer to variable to store Y coordinate. | |
4033 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4034 void API dw_pointer_query_pos(long *x, long *y) |
3 | 4035 { |
4036 POINTL ptl; | |
4037 | |
4038 WinQueryPointerPos(HWND_DESKTOP, &ptl); | |
4039 if(x && y) | |
4040 { | |
4041 *x = ptl.x; | |
4042 *y = dw_screen_height() - ptl.y; | |
4043 } | |
4044 } | |
4045 | |
4046 /* | |
4047 * Sets the X and Y coordinates of the mouse pointer. | |
4048 * Parameters: | |
4049 * x: X coordinate. | |
4050 * y: Y coordinate. | |
4051 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4052 void API dw_pointer_set_pos(long x, long y) |
3 | 4053 { |
4054 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y); | |
4055 } | |
4056 | |
310
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
4057 |
3 | 4058 /* |
4059 * Create a container object to be packed. | |
4060 * Parameters: | |
4061 * id: An ID to be used for getting the resource from the | |
4062 * resource file. | |
4063 */ | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
347
diff
changeset
|
4064 HWND API dw_container_new(ULONG id, int multi) |
3 | 4065 { |
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
|
4066 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4067 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4068 WC_CONTAINER, | |
4069 NULL, | |
4070 WS_VISIBLE | CCS_READONLY | | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
347
diff
changeset
|
4071 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) | |
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
347
diff
changeset
|
4072 CCS_AUTOPOSITION, |
3 | 4073 0,0,2000,1000, |
4074 NULLHANDLE, | |
4075 HWND_TOP, | |
4076 id, | |
4077 NULL, | |
4078 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
|
4079 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
|
4080 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4081 dw_window_set_font(tmp, DefaultFont); |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
4082 dw_window_set_data(tmp, "_dw_container", (void *)1); |
3 | 4083 return tmp; |
4084 } | |
4085 | |
4086 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4087 * 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
|
4088 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4089 * 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
|
4090 * 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
|
4091 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4092 HWND API dw_tree_new(ULONG id) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4093 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4094 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
|
4095 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
|
4096 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
|
4097 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
|
4098 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4099 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
|
4100 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
|
4101 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
|
4102 NULLHANDLE, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4103 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
|
4104 id, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4105 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4106 NULL); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4107 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4108 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
|
4109 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
|
4110 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
|
4111 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
|
4112 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
|
4113 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
|
4114 |
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
|
4115 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
|
4116 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
|
4117 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
|
4118 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
|
4119 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
|
4120 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
|
4121 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4122 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4123 /* |
3 | 4124 * Create a new static text window (widget) to be packed. |
4125 * Parameters: | |
4126 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4127 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4128 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4129 HWND API dw_text_new(char *text, ULONG id) |
3 | 4130 { |
4131 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
4132 WC_STATIC, | |
4133 text, | |
4134 WS_VISIBLE | SS_TEXT, | |
4135 0,0,2000,1000, | |
4136 NULLHANDLE, | |
4137 HWND_TOP, | |
4138 id, | |
4139 NULL, | |
4140 NULL); | |
4141 dw_window_set_font(tmp, DefaultFont); | |
4142 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4143 return tmp; | |
4144 } | |
4145 | |
4146 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4147 * 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
|
4148 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4149 * text: The text to be display by the static text widget. |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4150 * id: An ID to be used with dw_window_from_id() or 0L. |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4151 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4152 HWND API dw_status_text_new(char *text, ULONG id) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4153 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4154 WindowData *blah = calloc(sizeof(WindowData), 1); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4155 HWND tmp = WinCreateWindow(HWND_OBJECT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4156 WC_STATIC, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4157 text, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4158 WS_VISIBLE | SS_TEXT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4159 0,0,2000,1000, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4160 NULLHANDLE, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4161 HWND_TOP, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4162 id, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4163 NULL, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4164 NULL); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4165 blah->oldproc = WinSubclassWindow(tmp, _statusproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4166 WinSetWindowPtr(tmp, QWP_USER, blah); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4167 dw_window_set_font(tmp, DefaultFont); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4168 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
|
4169 return tmp; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4170 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4171 |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4172 #ifndef MLS_LIMITVSCROLL |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4173 #define MLS_LIMITVSCROLL 0x00000080L |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4174 #endif |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4175 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4176 /* |
3 | 4177 * Create a new Multiline Editbox window (widget) to be packed. |
4178 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4179 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4180 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4181 HWND API dw_mle_new(ULONG id) |
3 | 4182 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4183 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4184 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4185 WC_MLE, | |
4186 "", | |
4187 WS_VISIBLE | | |
4188 MLS_BORDER | MLS_IGNORETAB | | |
152
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4189 MLS_READONLY | MLS_VSCROLL | |
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4190 MLS_LIMITVSCROLL, |
3 | 4191 0,0,2000,1000, |
4192 NULLHANDLE, | |
4193 HWND_TOP, | |
4194 id, | |
4195 NULL, | |
4196 NULL); | |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
4197 blah->oldproc = WinSubclassWindow(tmp, _mleproc); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4198 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4199 dw_window_set_font(tmp, DefaultFont); |
3 | 4200 return tmp; |
4201 } | |
4202 | |
4203 /* | |
4204 * Create a new Entryfield window (widget) to be packed. | |
4205 * Parameters: | |
4206 * text: The default text to be in the entryfield widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4207 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4208 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4209 HWND API dw_entryfield_new(char *text, ULONG id) |
3 | 4210 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4211 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4212 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4213 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4214 WC_ENTRYFIELD, | |
4215 text, | |
4216 WS_VISIBLE | ES_MARGIN | | |
4217 ES_AUTOSCROLL | WS_TABSTOP, | |
4218 0,0,2000,1000, | |
4219 NULLHANDLE, | |
4220 HWND_TOP, | |
4221 id, | |
4222 NULL, | |
4223 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4224 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4225 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4226 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4227 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4228 return tmp; |
4229 } | |
4230 | |
4231 /* | |
4232 * Create a new Entryfield (password) window (widget) to be packed. | |
4233 * Parameters: | |
4234 * text: The default text to be in the entryfield widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4235 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4236 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4237 HWND API dw_entryfield_password_new(char *text, ULONG id) |
3 | 4238 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4239 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4240 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4241 WC_ENTRYFIELD, | |
4242 text, | |
4243 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE | | |
4244 ES_AUTOSCROLL | WS_TABSTOP, | |
4245 0,0,2000,1000, | |
4246 NULLHANDLE, | |
4247 HWND_TOP, | |
4248 id, | |
4249 NULL, | |
4250 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4251 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4252 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4253 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4254 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4255 return tmp; |
4256 } | |
4257 | |
4258 /* | |
4259 * Create a new Combobox window (widget) to be packed. | |
4260 * Parameters: | |
4261 * text: The default text to be in the combpbox widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4262 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4263 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4264 HWND API dw_combobox_new(char *text, ULONG id) |
3 | 4265 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4266 WindowData *blah = calloc(1, sizeof(WindowData)); |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
4267 HWND frame = dw_box_new(DW_HORZ, 0); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
4268 HWND tmp = WinCreateWindow(frame, |
3 | 4269 WC_COMBOBOX, |
4270 text, | |
4271 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, | |
4272 0,0,2000,1000, | |
4273 NULLHANDLE, | |
4274 HWND_TOP, | |
4275 id, | |
4276 NULL, | |
4277 NULL); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4278 HENUM henum = WinBeginEnumWindows(tmp); |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
4279 HWND child, last = NULLHANDLE; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4280 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4281 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
|
4282 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4283 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
|
4284 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4285 WinSetWindowPtr(child, QWP_USER, moreblah); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4286 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE); |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
4287 last = child; |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4288 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4289 WinEndEnumWindows(henum); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4290 blah->oldproc = WinSubclassWindow(tmp, _comboproc); |
3 | 4291 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4292 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4293 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
377
d8176c73a081
Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
376
diff
changeset
|
4294 dw_window_set_data(tmp, "_dw_comboentry", (void *)last); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
4295 dw_window_set_data(tmp, "_dw_combo_box", (void *)frame); |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
4296 WinSetOwner(tmp, frame); |
3 | 4297 return tmp; |
4298 } | |
4299 | |
4300 /* | |
4301 * Create a new button window (widget) to be packed. | |
4302 * Parameters: | |
4303 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4304 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4305 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4306 HWND API dw_button_new(char *text, ULONG id) |
3 | 4307 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4308 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4309 |
4310 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
4311 WC_BUTTON, | |
4312 text, | |
4313 WS_VISIBLE, | |
4314 0,0,2000,1000, | |
4315 NULLHANDLE, | |
4316 HWND_TOP, | |
4317 id, | |
4318 NULL, | |
4319 NULL); | |
4320 | |
4321 bubble->id = id; | |
4322 bubble->bubbletext[0] = '\0'; | |
4323 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4324 | |
4325 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
4326 dw_window_set_font(tmp, DefaultFont); | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4327 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4328 return tmp; |
4329 } | |
4330 | |
4331 /* Function: GenResIDStr | |
4332 ** Abstract: Generate string '#nnnn' for a given ID for using with Button | |
4333 ** controls | |
4334 */ | |
4335 | |
4336 void _GenResIDStr(CHAR *buff, ULONG ulID) | |
4337 { | |
4338 char *str; | |
4339 int slen = 0; | |
4340 | |
4341 *buff++ = '#'; | |
4342 | |
4343 str = buff; | |
4344 | |
4345 do | |
4346 { | |
4347 *str++ = (ulID % 10) + '0'; | |
4348 ulID /= 10; | |
4349 slen++; | |
4350 } | |
4351 while(ulID); | |
4352 | |
4353 *str-- = 0; | |
4354 | |
4355 for(; str > buff; str--, buff++) | |
4356 { | |
4357 *buff ^= *str; | |
4358 *str ^= *buff; | |
4359 *buff ^= *str; | |
4360 } | |
4361 } | |
4362 | |
4363 | |
4364 /* | |
4365 * Create a new bitmap button window (widget) to be packed. | |
4366 * Parameters: | |
4367 * text: Bubble help text to be displayed. | |
4368 * id: An ID of a bitmap in the resource file. | |
4369 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4370 HWND API dw_bitmapbutton_new(char *text, ULONG id) |
3 | 4371 { |
4372 char idbuf[256]; | |
4373 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
|
4374 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4375 |
4376 _GenResIDStr(idbuf, id); | |
4377 | |
4378 tmp = WinCreateWindow(HWND_OBJECT, | |
4379 WC_BUTTON, | |
4380 idbuf, | |
4381 WS_VISIBLE | BS_PUSHBUTTON | | |
4382 BS_BITMAP | BS_AUTOSIZE | | |
4383 BS_NOPOINTERFOCUS, | |
4384 0,0,2000,1000, | |
4385 NULLHANDLE, | |
4386 HWND_TOP, | |
4387 id, | |
4388 NULL, | |
4389 NULL); | |
4390 | |
4391 bubble->id = id; | |
4392 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | |
4393 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
4394 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4395 | |
4396 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4397 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1); |
3 | 4398 return tmp; |
4399 } | |
4400 | |
4401 /* | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4402 * Create a new bitmap button window (widget) to be packed from a file. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4403 * Parameters: |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4404 * text: Bubble help text to be displayed. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4405 * id: An ID to be used with dw_window_from_id() or 0L. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4406 * filename: Name of the file, omit extention to have |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4407 * DW pick the appropriate file extension. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4408 * (BMP on OS/2 or Windows, XPM on Unix) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4409 */ |
280
030188d45a69
Fixed typo in the filename parameter.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
278
diff
changeset
|
4410 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4411 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4412 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4413 HWND tmp = WinCreateWindow(HWND_OBJECT, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4414 WC_BUTTON, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4415 "", |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4416 WS_VISIBLE | BS_PUSHBUTTON | |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4417 BS_AUTOSIZE | BS_NOPOINTERFOCUS, |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4418 0,0,2000,1000, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4419 NULLHANDLE, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4420 HWND_TOP, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4421 id, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4422 NULL, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4423 NULL); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4424 char *file = alloca(strlen(filename) + 5); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4425 HPIXMAP pixmap = NULL, disabled = NULL; |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4426 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4427 if(file && (pixmap = calloc(1,sizeof(struct _hpixmap)))) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4428 { |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4429 int z, j, lim; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4430 LONG fore; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4431 |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4432 strcpy(file, filename); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4433 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4434 /* check if we can read from this file (it exists and read permission) */ |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4435 if(access(file, 04) != 0) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4436 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4437 /* Try with .bmp extention */ |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4438 strcat(file, ".bmp"); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4439 if(access(file, 04) != 0) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4440 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4441 free(pixmap); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4442 pixmap = NULL; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4443 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4444 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4445 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4446 /* Try to load the bitmap from file */ |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4447 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4448 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4449 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4450 /* Create a disabled style pixmap */ |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4451 disabled = dw_pixmap_new(tmp, pixmap->width, pixmap->height, dw_color_depth()); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4452 dw_pixmap_bitblt(0, disabled, 0, 0, pixmap->width, pixmap->height, 0, pixmap, 0, 0); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4453 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4454 fore = _foreground; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4455 dw_color_foreground_set(DW_CLR_PALEGRAY); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4456 lim = pixmap->width/2; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4457 for(j=0;j<pixmap->height;j++) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4458 { |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4459 int mod = j%2; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4460 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4461 for(z=0;z<lim;z++) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4462 dw_draw_point(0, disabled, (z*2)+mod, j); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4463 } |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4464 _foreground = fore; |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4465 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4466 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4467 bubble->id = id; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4468 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4469 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4470 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4471 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4472 WinSetWindowPtr(tmp, QWP_USER, bubble); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4473 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4474 dw_window_set_data(tmp, "_dw_hpixmap", (void *)pixmap); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4475 dw_window_set_data(tmp, "_dw_hpixmap_disabled", (void *)disabled); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4476 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1); |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4477 return tmp; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4478 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4479 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4480 /* |
3 | 4481 * Create a new spinbutton window (widget) to be packed. |
4482 * Parameters: | |
4483 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4484 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4485 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4486 HWND API dw_spinbutton_new(char *text, ULONG id) |
3 | 4487 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4488 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4489 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4490 WC_SPINBUTTON, | |
4491 text, | |
4492 WS_VISIBLE | SPBS_MASTER, | |
4493 0,0,2000,1000, | |
4494 NULLHANDLE, | |
4495 HWND_TOP, | |
4496 id, | |
4497 NULL, | |
4498 NULL); | |
156 | 4499 HWND entry = _find_entryfield(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
|
4500 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4501 WinSetWindowPtr(tmp, QWP_USER, blah); |
156 | 4502 blah = calloc(sizeof(WindowData), 1); |
4503 blah->oldproc = WinSubclassWindow(entry, _spinentryproc); | |
4504 WinSetWindowPtr(entry, QWP_USER, blah); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4505 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4506 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4507 return tmp; |
4508 } | |
4509 | |
4510 /* | |
4511 * Create a new radiobutton window (widget) to be packed. | |
4512 * Parameters: | |
4513 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4514 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4515 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4516 HWND API dw_radiobutton_new(char *text, ULONG id) |
3 | 4517 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4518 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4519 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4520 WC_BUTTON, | |
4521 text, | |
4522 WS_VISIBLE | | |
4523 BS_AUTORADIOBUTTON, | |
4524 0,0,2000,1000, | |
4525 NULLHANDLE, | |
4526 HWND_TOP, | |
4527 id, | |
4528 NULL, | |
4529 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4530 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4531 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4532 dw_window_set_font(tmp, DefaultFont); |
4533 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4534 return tmp; | |
4535 } | |
4536 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4537 |
3 | 4538 /* |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4539 * 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
|
4540 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4541 * 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
|
4542 * increments: Number of increments available. |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4543 * id: An ID to be used with dw_window_from_id() or 0L. |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4544 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4545 HWND API dw_slider_new(int vertical, int increments, ULONG id) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4546 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4547 WindowData *blah = calloc(1, sizeof(WindowData)); |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4548 SLDCDATA sldcData = { 0, 0, 0, 0, 0 }; |
178
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4549 HWND tmp; |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4550 |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4551 sldcData.cbSize = sizeof(SLDCDATA); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4552 sldcData.usScale1Increments = increments; |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4553 |
178
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4554 tmp = WinCreateWindow(HWND_OBJECT, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4555 WC_SLIDER, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4556 "", |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4557 WS_VISIBLE | SLS_SNAPTOINCREMENT | |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4558 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4559 0,0,2000,1000, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4560 NULLHANDLE, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4561 HWND_TOP, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4562 id, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4563 &sldcData, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4564 NULL); |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4565 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4566 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
|
4567 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
|
4568 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
|
4569 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4570 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4571 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4572 * Create a new scrollbar window (widget) to be packed. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4573 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4574 * vertical: TRUE or FALSE if scrollbar is vertical. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4575 * increments: Number of increments available. |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4576 * id: An ID to be used with dw_window_from_id() or 0L. |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4577 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4578 HWND API dw_scrollbar_new(int vertical, int increments, ULONG id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4579 { |
207
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4580 return WinCreateWindow(HWND_OBJECT, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4581 WC_SCROLLBAR, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4582 "", |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4583 WS_VISIBLE | SBS_AUTOTRACK | |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4584 (vertical ? SBS_VERT : SBS_HORZ), |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4585 0,0,2000,1000, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4586 NULLHANDLE, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4587 HWND_TOP, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4588 id, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4589 NULL, |
767fca804cea
Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
203
diff
changeset
|
4590 NULL); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4591 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4592 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4593 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4594 * Create a new percent bar window (widget) to be packed. |
3 | 4595 * Parameters: |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4596 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4597 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4598 HWND API dw_percent_new(ULONG id) |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4599 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4600 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
|
4601 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
|
4602 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
|
4603 "", |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4604 WS_VISIBLE | SLS_READONLY |
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4605 | 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
|
4606 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
|
4607 NULLHANDLE, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4608 HWND_TOP, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4609 id, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4610 NULL, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4611 NULL); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4612 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
|
4613 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4614 dw_window_disable(tmp); |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4615 return tmp; |
3 | 4616 } |
4617 | |
4618 /* | |
4619 * Create a new checkbox window (widget) to be packed. | |
4620 * Parameters: | |
4621 * text: The text to be display by the static text widget. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4622 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4623 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4624 HWND API dw_checkbox_new(char *text, ULONG id) |
3 | 4625 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4626 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4627 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4628 WC_BUTTON, | |
4629 text, | |
4630 WS_VISIBLE | BS_AUTOCHECKBOX, | |
4631 0,0,2000,1000, | |
4632 NULLHANDLE, | |
4633 HWND_TOP, | |
4634 id, | |
4635 NULL, | |
4636 NULL); | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4637 bubble->id = id; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4638 bubble->bubbletext[0] = '\0'; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4639 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4640 WinSetWindowPtr(tmp, QWP_USER, bubble); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4641 dw_window_set_font(tmp, DefaultFont); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4642 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4643 return tmp; |
4644 } | |
4645 | |
4646 /* | |
4647 * Create a new listbox window (widget) to be packed. | |
4648 * Parameters: | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4649 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4650 * multi: Multiple select TRUE or FALSE. |
4651 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4652 HWND API dw_listbox_new(ULONG id, int multi) |
3 | 4653 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4654 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4655 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4656 WC_LISTBOX, | |
4657 NULL, | |
4658 WS_VISIBLE | LS_NOADJUSTPOS | | |
4659 (multi ? LS_MULTIPLESEL : 0), | |
4660 0,0,2000,1000, | |
4661 NULLHANDLE, | |
4662 HWND_TOP, | |
4663 id, | |
4664 NULL, | |
4665 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4666 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4667 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4668 dw_window_set_font(tmp, DefaultFont); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4669 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4670 return tmp; |
4671 } | |
4672 | |
4673 /* | |
4674 * Sets the icon used for a given window. | |
4675 * Parameters: | |
4676 * handle: Handle to the window. | |
4677 * id: An ID to be used to specify the icon. | |
4678 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4679 void API dw_window_set_icon(HWND handle, ULONG id) |
3 | 4680 { |
336
a2f72b5d5d0a
Minor change to dw_window_set_icon() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
4681 HPOINTER icon = id < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id) : (HPOINTER)id; |
3 | 4682 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0); |
4683 } | |
4684 | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4685 /* Internal function to load a bitmap from a file and return handles |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4686 * to the bitmap, presentation space etc. |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4687 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4688 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4689 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4690 HFILE BitmapFileHandle = NULLHANDLE; /* handle for the file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4691 ULONG OpenAction = 0; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4692 PBYTE BitmapFileBegin; /* pointer to the first byte of bitmap data */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4693 FILESTATUS BitmapStatus; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4694 ULONG cbRead; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4695 PBITMAPFILEHEADER2 pBitmapFileHeader; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4696 PBITMAPINFOHEADER2 pBitmapInfoHeader; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4697 ULONG ScanLines, ulFlags; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4698 HPS hps1; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4699 HDC hdc1; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4700 SIZEL sizl = { 0, 0 }; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4701 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4702 /* open bitmap file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4703 DosOpen(file, &BitmapFileHandle, &OpenAction, 0L, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4704 FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4705 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4706 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY | |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4707 OPEN_FLAGS_NOINHERIT, 0L); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4708 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4709 if(!BitmapFileHandle) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4710 return 0; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4711 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4712 /* find out how big the file is */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4713 DosQueryFileInfo(BitmapFileHandle, 1, &BitmapStatus, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4714 sizeof(BitmapStatus)); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4715 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4716 /* allocate memory to load the bitmap */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4717 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)BitmapStatus.cbFile, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4718 PAG_READ | PAG_WRITE | PAG_COMMIT); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4719 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4720 /* read bitmap file into memory buffer */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4721 DosRead(BitmapFileHandle, (PVOID)BitmapFileBegin, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4722 BitmapStatus.cbFile, &cbRead); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4723 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4724 /* access first bytes as bitmap header */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4725 pBitmapFileHeader = (PBITMAPFILEHEADER2)BitmapFileBegin; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4726 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4727 /* check if it's a valid bitmap data file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4728 if((pBitmapFileHeader->usType != BFT_BITMAPARRAY) && |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4729 (pBitmapFileHeader->usType != BFT_BMAP)) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4730 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4731 /* free memory of bitmap file buffer */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4732 DosFreeMem(BitmapFileBegin); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4733 /* close the bitmap file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4734 DosClose(BitmapFileHandle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4735 return 0; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4736 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4737 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4738 /* check if it's a file with multiple bitmaps */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4739 if(pBitmapFileHeader->usType == BFT_BITMAPARRAY) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4740 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4741 /* we'll just use the first bitmap and ignore the others */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4742 pBitmapFileHeader = &(((PBITMAPARRAYFILEHEADER2)BitmapFileBegin)->bfh2); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4743 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4744 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4745 /* set pointer to bitmap information block */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4746 pBitmapInfoHeader = &pBitmapFileHeader->bmp2; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4747 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4748 /* find out if it's the new 2.0 format or the old format */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4749 /* and query number of lines */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4750 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER)) |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4751 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4752 *height = ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4753 *width = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cx; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4754 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4755 else |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4756 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4757 *height = ScanLines = pBitmapInfoHeader->cy; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4758 *width = pBitmapInfoHeader->cx; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4759 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4760 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4761 /* now we need a presentation space, get it from static control */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4762 hps1 = WinGetPS(handle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4763 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4764 hdc1 = GpiQueryDevice(hps1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4765 ulFlags = GpiQueryPS(hps1, &sizl); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4766 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4767 *hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4768 *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4769 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4770 /* create bitmap now using the parameters from the info block */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4771 *hbm = GpiCreateBitmap(*hps, pBitmapInfoHeader, 0L, NULL, NULL); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4772 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4773 /* select the new bitmap into presentation space */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4774 GpiSetBitmap(*hps, *hbm); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4775 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4776 /* now copy the bitmap data into the bitmap */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4777 GpiSetBitmapBits(*hps, 0L, ScanLines, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4778 BitmapFileBegin + pBitmapFileHeader->offBits, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4779 (PBITMAPINFO2)pBitmapInfoHeader); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4780 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4781 WinReleasePS(hps1); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4782 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4783 /* free memory of bitmap file buffer */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4784 DosFreeMem(BitmapFileBegin); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4785 /* close the bitmap file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4786 DosClose(BitmapFileHandle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4787 return 1; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4788 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4789 |
3 | 4790 /* |
4791 * Sets the bitmap used for a given static window. | |
4792 * Parameters: | |
4793 * handle: Handle to the window. | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4794 * id: An ID to be used to specify the icon, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4795 * (pass 0 if you use the filename param) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4796 * filename: a path to a file (Bitmap on OS/2 or |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4797 * Windows and a pixmap on Unix, pass |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4798 * NULL if you use the id param) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4799 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4800 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) |
3 | 4801 { |
4802 HBITMAP hbm; | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4803 HPS hps; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4804 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4805 /* Destroy any old bitmap data */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4806 _free_bitmap(handle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4807 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4808 /* If id is non-zero use the resource */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4809 if(id) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4810 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4811 hps = WinGetPS(handle); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4812 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4813 hbm = GpiLoadBitmap(hps, NULLHANDLE, id, 0, 0); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4814 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4815 else if(filename) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4816 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4817 HDC hdc; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4818 unsigned long width, height; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4819 char *file = alloca(strlen(filename) + 5); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4820 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4821 if(!file) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4822 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4823 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4824 strcpy(file, filename); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4825 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4826 /* check if we can read from this file (it exists and read permission) */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4827 if(access(file, 04) != 0) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4828 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4829 /* Try with .bmp extention */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4830 strcat(file, ".bmp"); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4831 if(access(file, 04) != 0) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4832 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4833 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4834 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4835 if(!_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height)) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4836 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4837 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4838 dw_window_set_data(handle, "_dw_hps", (void *)hps); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4839 dw_window_set_data(handle, "_dw_hdc", (void *)hdc); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4840 dw_window_set_data(handle, "_dw_width", (void *)width); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4841 dw_window_set_data(handle, "_dw_height", (void *)height); |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4842 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4843 else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4844 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4845 |
3 | 4846 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f); |
4847 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL ); | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4848 if(id) |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4849 WinReleasePS(hps); |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
4850 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm); |
3 | 4851 } |
4852 | |
4853 /* | |
4854 * Sets the text used for a given window. | |
4855 * Parameters: | |
4856 * handle: Handle to the window. | |
4857 * text: The text associsated with a given window. | |
4858 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4859 void API dw_window_set_text(HWND handle, char *text) |
3 | 4860 { |
4861 WinSetWindowText(handle, text); | |
4862 } | |
4863 | |
4864 /* | |
4865 * Gets the text used for a given window. | |
4866 * Parameters: | |
4867 * handle: Handle to the window. | |
4868 * Returns: | |
4869 * text: The text associsated with a given window. | |
4870 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4871 char * API dw_window_get_text(HWND handle) |
3 | 4872 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4873 int len = WinQueryWindowTextLength(handle); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4874 char *tempbuf = calloc(1, len + 2); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4875 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4876 WinQueryWindowText(handle, len + 1, tempbuf); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4877 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4878 return tempbuf; |
3 | 4879 } |
4880 | |
4881 /* | |
4882 * Disables given window (widget). | |
4883 * Parameters: | |
4884 * handle: Handle to the window. | |
4885 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4886 void API dw_window_disable(HWND handle) |
3 | 4887 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4888 char tmpbuf[100]; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4889 |
166
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
4890 if(dw_window_get_data(handle, "_dw_disabled")) |
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
4891 return; |
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
4892 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4893 WinQueryClassName(handle, 99, tmpbuf); |
166
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
4894 dw_window_set_data(handle, "_dw_disabled", (void *)1); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4895 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4896 if(tmpbuf[0] == '#') |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4897 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4898 int val = atoi(&tmpbuf[1]); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4899 HWND hwnd; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4900 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4901 switch(val) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4902 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4903 case 2: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4904 case 6: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4905 case 10: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4906 case 32: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4907 case 7: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4908 hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4909 _dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
4910 dw_signal_connect(hwnd ? hwnd : handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
4911 if(val == 2) |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
4912 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4913 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4914 dw_window_set_data(hwnd, "_dw_disabled", (void *)1); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4915 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4916 case 3: |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4917 if(dw_window_get_data(handle, "_dw_bitmapbutton") && !dw_window_get_data(handle, "_dw_hpixmap")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4918 WinEnableWindow(handle, FALSE); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4919 else if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4920 WinInvalidateRect(handle, NULL, FALSE); |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4921 else |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4922 _dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY); |
307
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
4923 dw_signal_connect(handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
324587c06cea
Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
306
diff
changeset
|
4924 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4925 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4926 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4927 } |
3 | 4928 WinEnableWindow(handle, FALSE); |
4929 } | |
4930 | |
4931 /* | |
4932 * Enables given window (widget). | |
4933 * Parameters: | |
4934 * handle: Handle to the window. | |
4935 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4936 void API dw_window_enable(HWND handle) |
3 | 4937 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4938 ULONG fore = (ULONG)dw_window_get_data(handle, "_dw_fore"); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4939 ULONG back = (ULONG)dw_window_get_data(handle, "_dw_back"); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4940 HWND hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4941 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4942 dw_window_set_data(handle, "_dw_disabled", 0); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4943 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4944 dw_window_set_data(hwnd, "_dw_disabled", 0); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4945 if(fore && back) |
228
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
4946 _dw_window_set_color(hwnd ? hwnd : handle, fore-1, back-1); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4947 dw_signal_disconnect_by_data(handle, (void *)100); |
3 | 4948 WinEnableWindow(handle, TRUE); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4949 if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled")) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4950 WinInvalidateRect(handle, NULL, FALSE); |
3 | 4951 } |
4952 | |
4953 /* | |
4954 * Gets the child window handle with specified ID. | |
4955 * Parameters: | |
4956 * handle: Handle to the parent window. | |
4957 * id: Integer ID of the child. | |
4958 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4959 HWND API dw_window_from_id(HWND handle, int id) |
3 | 4960 { |
4961 HENUM henum; | |
4962 HWND child; | |
4963 char tmpbuf[100]; | |
4964 | |
4965 henum = WinBeginEnumWindows(handle); | |
4966 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
4967 { | |
4968 int windowid = WinQueryWindowUShort(child, QWS_ID); | |
4969 HWND found; | |
4970 | |
4971 WinQueryClassName(child, 99, tmpbuf); | |
4972 | |
4973 /* 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
|
4974 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 4975 if((found = dw_window_from_id(child, id)) != NULLHANDLE) |
4976 return found; | |
4977 | |
4978 if(windowid && windowid == id) | |
4979 { | |
4980 WinEndEnumWindows(henum); | |
4981 return child; | |
4982 } | |
4983 } | |
4984 WinEndEnumWindows(henum); | |
4985 return NULLHANDLE; | |
4986 } | |
4987 | |
4988 /* | |
4989 * Pack windows (widgets) into a box from the end (or bottom). | |
4990 * Parameters: | |
4991 * box: Window handle of the box to be packed into. | |
4992 * item: Window handle of the item to be back. | |
4993 * width: Width in pixels of the item or -1 to be self determined. | |
4994 * height: Height in pixels of the item or -1 to be self determined. | |
4995 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
4996 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
4997 * pad: Number of pixels of padding around the item. | |
4998 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4999 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 5000 { |
5001 Box *thisbox; | |
5002 | |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5003 /* |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5004 * If you try and pack an item into itself VERY bad things can happen; like at least an |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5005 * infinite loop on GTK! Lets be safe! |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5006 */ |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5007 if(box == item) |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5008 { |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5009 dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5010 return; |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5011 } |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
5012 |
3 | 5013 if(WinWindowFromID(box, FID_CLIENT)) |
5014 { | |
5015 box = WinWindowFromID(box, FID_CLIENT); | |
5016 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
5017 } | |
5018 else | |
5019 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
5020 if(thisbox) | |
5021 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
5022 if(thisbox->type == DW_HORZ) |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5023 _dw_box_pack_start(box, item, width, height, hsize, vsize, pad, "dw_box_pack_end()"); |
3 | 5024 else |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5025 _dw_box_pack_end(box, item, width, height, hsize, vsize, pad, "dw_box_pack_end()"); |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5026 } |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5027 } |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5028 |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5029 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname) |
3 | 5030 { |
5031 Box *thisbox; | |
5032 | |
5033 if(WinWindowFromID(box, FID_CLIENT)) | |
5034 { | |
5035 box = WinWindowFromID(box, FID_CLIENT); | |
5036 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
5037 hsize = TRUE; | |
5038 vsize = TRUE; | |
5039 } | |
5040 else | |
5041 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
5042 if(!thisbox) | |
5043 { | |
5044 box = WinWindowFromID(box, FID_CLIENT); | |
5045 if(box) | |
5046 { | |
5047 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
5048 hsize = TRUE; | |
5049 vsize = TRUE; | |
5050 } | |
5051 } | |
5052 if(thisbox) | |
5053 { | |
5054 int z; | |
5055 Item *tmpitem, *thisitem = thisbox->items; | |
5056 char tmpbuf[100]; | |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
5057 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box"); |
3 | 5058 |
5059 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
5060 | |
5061 for(z=0;z<thisbox->count;z++) | |
5062 { | |
5063 tmpitem[z] = thisitem[z]; | |
5064 } | |
5065 | |
5066 WinQueryClassName(item, 99, tmpbuf); | |
5067 | |
298
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5068 if(vsize && !height) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5069 height = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5070 if(hsize && !width) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5071 width = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
5072 |
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
|
5073 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 5074 tmpitem[thisbox->count].type = TYPEBOX; |
5075 else | |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5076 { |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5077 if ( width == 0 && hsize == FALSE ) |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5078 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5079 if ( height == 0 && vsize == FALSE ) |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5080 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5081 |
3 | 5082 tmpitem[thisbox->count].type = TYPEITEM; |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
5083 } |
3 | 5084 |
5085 tmpitem[thisbox->count].hwnd = item; | |
5086 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width; | |
5087 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height; | |
5088 tmpitem[thisbox->count].pad = pad; | |
5089 if(hsize) | |
5090 tmpitem[thisbox->count].hsize = SIZEEXPAND; | |
5091 else | |
5092 tmpitem[thisbox->count].hsize = SIZESTATIC; | |
5093 | |
5094 if(vsize) | |
5095 tmpitem[thisbox->count].vsize = SIZEEXPAND; | |
5096 else | |
5097 tmpitem[thisbox->count].vsize = SIZESTATIC; | |
5098 | |
5099 thisbox->items = tmpitem; | |
5100 | |
5101 if(thisbox->count) | |
5102 free(thisitem); | |
5103 | |
5104 thisbox->count++; | |
5105 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
5106 /* Don't set the ownership if it's an entryfield or spinbutton */ |
3 | 5107 WinQueryClassName(item, 99, tmpbuf); |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
5108 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5109 WinSetOwner(item, box); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
5110 WinSetParent(frame ? frame : item, box, FALSE); |
3 | 5111 } |
5112 } | |
5113 | |
5114 /* | |
5115 * Sets the size of a given window (widget). | |
5116 * Parameters: | |
5117 * handle: Window (widget) handle. | |
5118 * width: New width in pixels. | |
5119 * height: New height in pixels. | |
5120 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5121 void API dw_window_set_usize(HWND handle, ULONG width, ULONG height) |
3 | 5122 { |
5123 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); | |
5124 } | |
5125 | |
5126 /* | |
5127 * Returns the width of the screen. | |
5128 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5129 int API dw_screen_width(void) |
3 | 5130 { |
5131 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); | |
5132 } | |
5133 | |
5134 /* | |
5135 * Returns the height of the screen. | |
5136 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5137 int API dw_screen_height(void) |
3 | 5138 { |
5139 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); | |
5140 } | |
5141 | |
5142 /* This should return the current color depth */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5143 unsigned long API dw_color_depth(void) |
3 | 5144 { |
5145 HDC hdc = WinOpenWindowDC(HWND_DESKTOP); | |
5146 long colors; | |
5147 | |
5148 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); | |
5149 DevCloseDC(hdc); | |
5150 return colors; | |
5151 } | |
5152 | |
5153 | |
5154 /* | |
5155 * Sets the position of a given window (widget). | |
5156 * Parameters: | |
5157 * handle: Window (widget) handle. | |
5158 * x: X location from the bottom left. | |
5159 * y: Y location from the bottom left. | |
5160 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5161 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y) |
3 | 5162 { |
5163 int myy = _get_frame_height(handle) - (y + _get_height(handle)); | |
5164 | |
5165 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE); | |
5166 } | |
5167 | |
5168 /* | |
5169 * Sets the position and size of a given window (widget). | |
5170 * Parameters: | |
5171 * handle: Window (widget) handle. | |
5172 * x: X location from the bottom left. | |
5173 * y: Y location from the bottom left. | |
5174 * width: Width of the widget. | |
5175 * height: Height of the widget. | |
5176 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5177 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) |
3 | 5178 { |
5179 int myy = _get_frame_height(handle) - (y + height); | |
5180 | |
5181 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); | |
5182 } | |
5183 | |
5184 /* | |
5185 * Gets the position and size of a given window (widget). | |
5186 * Parameters: | |
5187 * handle: Window (widget) handle. | |
5188 * x: X location from the bottom left. | |
5189 * y: Y location from the bottom left. | |
5190 * width: Width of the widget. | |
5191 * height: Height of the widget. | |
5192 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5193 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) |
3 | 5194 { |
5195 SWP swp; | |
5196 WinQueryWindowPos(handle, &swp); | |
5197 if(x) | |
5198 *x = swp.x; | |
5199 if(y) | |
5200 *y = _get_frame_height(handle) - (swp.y + swp.cy); | |
5201 if(width) | |
5202 *width = swp.cx; | |
5203 if(height) | |
5204 *height = swp.cy; | |
5205 } | |
5206 | |
5207 /* | |
5208 * Sets the style of a given window (widget). | |
5209 * Parameters: | |
5210 * handle: Window (widget) handle. | |
5211 * width: New width in pixels. | |
5212 * height: New height in pixels. | |
5213 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5214 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
3 | 5215 { |
5216 WinSetWindowBits(handle, QWL_STYLE, style, mask); | |
5217 } | |
5218 | |
5219 /* | |
5220 * Adds a new page to specified notebook. | |
5221 * Parameters: | |
5222 * handle: Window (widget) handle. | |
5223 * flags: Any additional page creation flags. | |
5224 * front: If TRUE page is added at the beginning. | |
5225 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5226 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) |
3 | 5227 { |
5228 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L, | |
347
0137c30f485e
Simplified dw_notebook_page_new code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
346
diff
changeset
|
5229 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST)); |
3 | 5230 } |
5231 | |
5232 /* | |
5233 * Remove a page from a notebook. | |
5234 * Parameters: | |
5235 * handle: Handle to the notebook widget. | |
5236 * pageid: ID of the page to be destroyed. | |
5237 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5238 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
3 | 5239 { |
5240 WinSendMsg(handle, BKM_DELETEPAGE, | |
5241 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE); | |
5242 } | |
5243 | |
5244 /* | |
5245 * Queries the currently visible page ID. | |
5246 * Parameters: | |
5247 * handle: Handle to the notebook widget. | |
5248 */ | |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
5249 unsigned long API dw_notebook_page_query(HWND handle) |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
5250 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
5251 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR)); |
3 | 5252 } |
5253 | |
5254 /* | |
5255 * Sets the currently visibale page ID. | |
5256 * Parameters: | |
5257 * handle: Handle to the notebook widget. | |
5258 * pageid: ID of the page to be made visible. | |
5259 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5260 void API dw_notebook_page_set(HWND handle, unsigned int pageid) |
3 | 5261 { |
5262 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L); | |
5263 } | |
5264 | |
5265 /* | |
5266 * Sets the text on the specified notebook tab. | |
5267 * Parameters: | |
5268 * handle: Notebook handle. | |
5269 * pageid: Page ID of the tab to set. | |
5270 * text: Pointer to the text to set. | |
5271 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5272 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) |
3 | 5273 { |
5274 WinSendMsg(handle, BKM_SETTABTEXT, | |
5275 MPFROMLONG(pageid), MPFROMP(text)); | |
5276 } | |
5277 | |
5278 /* | |
5279 * Sets the text on the specified notebook tab status area. | |
5280 * Parameters: | |
5281 * handle: Notebook handle. | |
5282 * pageid: Page ID of the tab to set. | |
5283 * text: Pointer to the text to set. | |
5284 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5285 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) |
3 | 5286 { |
5287 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, | |
5288 MPFROMLONG(pageid), MPFROMP(text)); | |
5289 } | |
5290 | |
5291 /* | |
5292 * Packs the specified box into the notebook page. | |
5293 * Parameters: | |
5294 * handle: Handle to the notebook to be packed. | |
5295 * pageid: Page ID in the notebook which is being packed. | |
5296 * page: Box handle to be packed. | |
5297 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5298 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) |
3 | 5299 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
5300 HWND tmpbox = dw_box_new(DW_VERT, 0); |
3 | 5301 |
5302 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | |
5303 WinSubclassWindow(tmpbox, _wndproc); | |
5304 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, | |
5305 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); | |
5306 } | |
5307 | |
5308 /* | |
5309 * Appends the specified text to the listbox's (or combobox) entry list. | |
5310 * Parameters: | |
5311 * handle: Handle to the listbox to be appended to. | |
5312 * text: Text to append into listbox. | |
5313 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5314 void API dw_listbox_append(HWND handle, char *text) |
3 | 5315 { |
5316 WinSendMsg(handle, | |
5317 LM_INSERTITEM, | |
5318 MPFROMSHORT(LIT_END), | |
5319 MPFROMP(text)); | |
5320 } | |
5321 | |
5322 /* | |
5323 * Clears the listbox's (or combobox) list of all entries. | |
5324 * Parameters: | |
5325 * handle: Handle to the listbox to be cleared. | |
5326 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5327 void API dw_listbox_clear(HWND handle) |
3 | 5328 { |
5329 WinSendMsg(handle, | |
5330 LM_DELETEALL, 0L, 0L); | |
5331 } | |
5332 | |
5333 /* | |
5334 * Returns the listbox's item count. | |
5335 * Parameters: | |
5336 * handle: Handle to the listbox to be cleared. | |
5337 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5338 int API dw_listbox_count(HWND handle) |
3 | 5339 { |
5340 return (int)WinSendMsg(handle, | |
5341 LM_QUERYITEMCOUNT,0L, 0L); | |
5342 } | |
5343 | |
5344 /* | |
5345 * Sets the topmost item in the viewport. | |
5346 * Parameters: | |
5347 * handle: Handle to the listbox to be cleared. | |
5348 * top: Index to the top item. | |
5349 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5350 void API dw_listbox_set_top(HWND handle, int top) |
3 | 5351 { |
5352 WinSendMsg(handle, | |
5353 LM_SETTOPINDEX, | |
5354 MPFROMSHORT(top), | |
5355 0L); | |
5356 } | |
5357 | |
5358 /* | |
5359 * Copies the given index item's text into buffer. | |
5360 * Parameters: | |
5361 * handle: Handle to the listbox to be queried. | |
5362 * index: Index into the list to be queried. | |
5363 * buffer: Buffer where text will be copied. | |
5364 * length: Length of the buffer (including NULL). | |
5365 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5366 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
3 | 5367 { |
5368 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer); | |
5369 } | |
5370 | |
5371 /* | |
5372 * Sets the text of a given listbox entry. | |
5373 * Parameters: | |
5374 * handle: Handle to the listbox to be queried. | |
5375 * index: Index into the list to be queried. | |
5376 * buffer: Buffer where text will be copied. | |
5377 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5378 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) |
3 | 5379 { |
5380 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); | |
5381 } | |
5382 | |
5383 /* | |
5384 * Returns the index to the item in the list currently selected. | |
5385 * Parameters: | |
5386 * handle: Handle to the listbox to be queried. | |
5387 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5388 unsigned int API dw_listbox_selected(HWND handle) |
3 | 5389 { |
5390 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
|
5391 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
|
5392 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
|
5393 0); |
3 | 5394 } |
5395 | |
5396 /* | |
5397 * Returns the index to the current selected item or -1 when done. | |
5398 * Parameters: | |
5399 * handle: Handle to the listbox to be queried. | |
5400 * where: Either the previous return or -1 to restart. | |
5401 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5402 int API dw_listbox_selected_multi(HWND handle, int where) |
3 | 5403 { |
5404 int place = where; | |
5405 | |
5406 if(where == -1) | |
5407 place = LIT_FIRST; | |
5408 | |
5409 place = (int)WinSendMsg(handle, | |
5410 LM_QUERYSELECTION, | |
5411 MPFROMSHORT(place),0L); | |
5412 if(place == LIT_NONE) | |
5413 return -1; | |
5414 return place; | |
5415 } | |
5416 | |
5417 /* | |
5418 * Sets the selection state of a given index. | |
5419 * Parameters: | |
5420 * handle: Handle to the listbox to be set. | |
5421 * index: Item index. | |
5422 * state: TRUE if selected FALSE if unselected. | |
5423 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5424 void API dw_listbox_select(HWND handle, int index, int state) |
3 | 5425 { |
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
|
5426 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
|
5427 |
3 | 5428 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
|
5429 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5430 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
|
5431 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5432 /* 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
|
5433 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
|
5434 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); |
3 | 5435 } |
5436 | |
5437 /* | |
5438 * Deletes the item with given index from the list. | |
5439 * Parameters: | |
5440 * handle: Handle to the listbox to be set. | |
5441 * index: Item index. | |
5442 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5443 void API dw_listbox_delete(HWND handle, int index) |
3 | 5444 { |
5445 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0); | |
5446 } | |
5447 | |
5448 /* | |
5449 * Adds text to an MLE box and returns the current point. | |
5450 * Parameters: | |
5451 * handle: Handle to the MLE to be queried. | |
5452 * buffer: Text buffer to be imported. | |
5453 * startpoint: Point to start entering text. | |
5454 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5455 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) |
3 | 5456 { |
5457 unsigned long point = startpoint; | |
5458 PBYTE mlebuf; | |
5459 | |
5460 /* Work around 64K limit */ | |
5461 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5462 { | |
5463 int amount, len = strlen(buffer), written = 0; | |
5464 | |
5465 while(written < len) | |
5466 { | |
5467 if((len - written) > 65535) | |
5468 amount = 65535; | |
5469 else | |
5470 amount = len - written; | |
5471 | |
5472 memcpy(mlebuf, &buffer[written], amount); | |
5473 mlebuf[amount] = '\0'; | |
5474 | |
5475 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1)); | |
5476 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); | |
5477 dw_mle_delete(handle, point, 1); | |
5478 | |
5479 written += amount; | |
5480 } | |
5481 DosFreeMem(mlebuf); | |
5482 } | |
5483 return point - 1; | |
5484 } | |
5485 | |
5486 /* | |
5487 * Grabs text from an MLE box. | |
5488 * Parameters: | |
5489 * handle: Handle to the MLE to be queried. | |
5490 * buffer: Text buffer to be exported. | |
5491 * startpoint: Point to start grabbing text. | |
5492 * length: Amount of text to be grabbed. | |
5493 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5494 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
3 | 5495 { |
5496 PBYTE mlebuf; | |
5497 | |
5498 /* Work around 64K limit */ | |
5499 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5500 { | |
5501 int amount, copied, written = 0; | |
5502 | |
5503 while(written < length) | |
5504 { | |
5505 if((length - written) > 65535) | |
5506 amount = 65535; | |
5507 else | |
5508 amount = length - written; | |
5509 | |
5510 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount)); | |
5511 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount)); | |
5512 | |
5513 if(copied) | |
5514 { | |
5515 memcpy(&buffer[written], mlebuf, copied); | |
5516 | |
5517 written += copied; | |
5518 } | |
5519 else | |
5520 break; | |
5521 } | |
5522 DosFreeMem(mlebuf); | |
5523 } | |
5524 } | |
5525 | |
5526 /* | |
5527 * Obtains information about an MLE box. | |
5528 * Parameters: | |
5529 * handle: Handle to the MLE to be queried. | |
5530 * bytes: A pointer to a variable to return the total bytes. | |
5531 * lines: A pointer to a variable to return the number of lines. | |
5532 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5533 void API dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines) |
3 | 5534 { |
5535 if(bytes) | |
5536 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0); | |
5537 if(lines) | |
5538 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0); | |
5539 } | |
5540 | |
5541 /* | |
5542 * Deletes text from an MLE box. | |
5543 * Parameters: | |
5544 * handle: Handle to the MLE to be deleted from. | |
5545 * startpoint: Point to start deleting text. | |
5546 * length: Amount of text to be deleted. | |
5547 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5548 void API dw_mle_delete(HWND handle, int startpoint, int length) |
3 | 5549 { |
5550 char *buf = malloc(length+1); | |
5551 int z, dellen = length; | |
5552 | |
5553 dw_mle_export(handle, buf, startpoint, length); | |
5554 | |
5555 for(z=0;z<length-1;z++) | |
5556 { | |
5557 if(strncmp(&buf[z], "\r\n", 2) == 0) | |
5558 dellen--; | |
5559 } | |
5560 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen)); | |
5561 free(buf); | |
5562 } | |
5563 | |
5564 /* | |
5565 * Clears all text from an MLE box. | |
5566 * Parameters: | |
5567 * handle: Handle to the MLE to be cleared. | |
5568 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5569 void API dw_mle_clear(HWND handle) |
3 | 5570 { |
5571 unsigned long bytes; | |
5572 | |
5573 dw_mle_query(handle, &bytes, NULL); | |
5574 | |
5575 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes)); | |
5576 } | |
5577 | |
5578 /* | |
5579 * Sets the visible line of an MLE box. | |
5580 * Parameters: | |
5581 * handle: Handle to the MLE to be positioned. | |
5582 * line: Line to be visible. | |
5583 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5584 void API dw_mle_set_visible(HWND handle, int line) |
3 | 5585 { |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
5586 int tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line), 0); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
5587 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt)); |
3 | 5588 } |
5589 | |
5590 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5591 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5592 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5593 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5594 * 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
|
5595 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5596 void API dw_mle_set_editable(HWND handle, int state) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5597 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5598 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5599 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5600 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5601 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5602 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5603 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5604 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5605 * 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
|
5606 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5607 void API dw_mle_set_word_wrap(HWND handle, int state) |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5608 { |
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
|
5609 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5610 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5611 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5612 /* |
3 | 5613 * Sets the current cursor position of an MLE box. |
5614 * Parameters: | |
5615 * handle: Handle to the MLE to be positioned. | |
5616 * point: Point to position cursor. | |
5617 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5618 void API dw_mle_set(HWND handle, int point) |
3 | 5619 { |
5620 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point)); | |
5621 } | |
5622 | |
5623 /* | |
5624 * Finds text in an MLE box. | |
5625 * Parameters: | |
5626 * handle: Handle to the MLE to be cleared. | |
5627 * text: Text to search for. | |
5628 * point: Start point of search. | |
5629 * flags: Search specific flags. | |
5630 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5631 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) |
3 | 5632 { |
5633 MLE_SEARCHDATA msd; | |
5634 | |
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
|
5635 /* 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
|
5636 * 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
|
5637 */ |
3 | 5638 msd.cb = sizeof(msd); |
5639 msd.pchFind = text; | |
5640 msd.pchReplace = NULL; | |
5641 msd.cchFind = strlen(text); | |
5642 msd.cchReplace = 0; | |
5643 msd.iptStart = point; | |
5644 msd.iptStop = -1; | |
5645 | |
5646 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd)) | |
5647 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0); | |
5648 return 0; | |
5649 } | |
5650 | |
5651 /* | |
5652 * Stops redrawing of an MLE box. | |
5653 * Parameters: | |
5654 * handle: Handle to the MLE to freeze. | |
5655 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5656 void API dw_mle_freeze(HWND handle) |
3 | 5657 { |
5658 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0); | |
5659 } | |
5660 | |
5661 /* | |
5662 * Resumes redrawing of an MLE box. | |
5663 * Parameters: | |
5664 * handle: Handle to the MLE to thaw. | |
5665 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5666 void API dw_mle_thaw(HWND handle) |
3 | 5667 { |
5668 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); | |
5669 } | |
5670 | |
5671 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5672 * Returns the range of the percent bar. |
3 | 5673 * 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
|
5674 * handle: Handle to the percent bar to be queried. |
3 | 5675 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5676 unsigned int API dw_percent_query_range(HWND handle) |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5677 { |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5678 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); |
3 | 5679 } |
5680 | |
5681 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5682 * Sets the percent bar position. |
3 | 5683 * 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
|
5684 * 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
|
5685 * position: Position of the percent bar withing the range. |
3 | 5686 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5687 void API dw_percent_set_pos(HWND handle, unsigned int position) |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5688 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5689 _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
|
5690 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position); |
3 | 5691 } |
5692 | |
5693 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5694 * 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
|
5695 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5696 * 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
|
5697 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5698 unsigned int API dw_slider_query_pos(HWND handle) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5699 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5700 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
|
5701 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5702 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5703 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5704 * 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
|
5705 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5706 * 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
|
5707 * 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
|
5708 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5709 void API dw_slider_set_pos(HWND handle, unsigned int 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
|
5710 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5711 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
|
5712 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
|
5713 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5714 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5715 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5716 * Returns the position of the scrollbar. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5717 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5718 * handle: Handle to the scrollbar to be queried. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5719 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5720 unsigned int API dw_scrollbar_query_pos(HWND handle) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5721 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5722 return (unsigned int)WinSendMsg(handle, SBM_QUERYPOS, 0, 0); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5723 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5724 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5725 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5726 * Sets the scrollbar position. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5727 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5728 * handle: Handle to the scrollbar to be set. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5729 * position: Position of the scrollbar withing the range. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5730 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5731 void API dw_scrollbar_set_pos(HWND handle, unsigned int position) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5732 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5733 dw_window_set_data(handle, "_dw_scrollbar_value", (void *)position); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5734 WinSendMsg(handle, SBM_SETPOS, (MPARAM)position, 0); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5735 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5736 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5737 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5738 * Sets the scrollbar range. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5739 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5740 * handle: Handle to the scrollbar to be set. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5741 * range: Maximum range value. |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5742 * visible: Visible area relative to the range. |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5743 */ |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5744 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible) |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5745 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5746 unsigned int pos = (unsigned int)dw_window_get_data(handle, "_dw_scrollbar_value"); |
203
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5747 WinSendMsg(handle, SBM_SETSCROLLBAR, (MPARAM)pos, MPFROM2SHORT(0, (unsigned short)range - visible)); |
e0beea487e8f
Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
199
diff
changeset
|
5748 WinSendMsg(handle, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)visible, range), 0); |
212
f2d1e231922e
Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
210
diff
changeset
|
5749 dw_window_set_data(handle, "_dw_scrollbar_visible", (void *)visible); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5750 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5751 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5752 /* |
3 | 5753 * Sets the spinbutton value. |
5754 * Parameters: | |
5755 * handle: Handle to the spinbutton to be set. | |
5756 * position: Current value of the spinbutton. | |
5757 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5758 void API dw_spinbutton_set_pos(HWND handle, long position) |
3 | 5759 { |
5760 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L); | |
5761 } | |
5762 | |
5763 /* | |
5764 * Sets the spinbutton limits. | |
5765 * Parameters: | |
5766 * handle: Handle to the spinbutton to be set. | |
5767 * upper: Upper limit. | |
5768 * lower: Lower limit. | |
5769 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5770 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
3 | 5771 { |
5772 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower)); | |
5773 } | |
5774 | |
5775 /* | |
5776 * Sets the entryfield character limit. | |
5777 * Parameters: | |
5778 * handle: Handle to the spinbutton to be set. | |
5779 * limit: Number of characters the entryfield will take. | |
5780 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5781 void API dw_entryfield_set_limit(HWND handle, ULONG limit) |
3 | 5782 { |
5783 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0); | |
5784 } | |
5785 | |
5786 | |
5787 /* | |
5788 * Returns the current value of the spinbutton. | |
5789 * Parameters: | |
5790 * handle: Handle to the spinbutton to be queried. | |
5791 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5792 long API dw_spinbutton_query(HWND handle) |
3 | 5793 { |
5794 long tmpval = 0L; | |
5795 | |
5796 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L); | |
5797 return tmpval; | |
5798 } | |
5799 | |
5800 /* | |
5801 * Returns the state of the checkbox. | |
5802 * Parameters: | |
5803 * handle: Handle to the checkbox to be queried. | |
5804 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5805 int API dw_checkbox_query(HWND handle) |
3 | 5806 { |
5807 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0); | |
5808 } | |
5809 | |
5810 /* | |
5811 * Sets the state of the checkbox. | |
5812 * Parameters: | |
5813 * handle: Handle to the checkbox to be queried. | |
5814 * value: TRUE for checked, FALSE for unchecked. | |
5815 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5816 void API dw_checkbox_set(HWND handle, int value) |
3 | 5817 { |
5818 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0); | |
5819 } | |
5820 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5821 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5822 * 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
|
5823 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5824 * 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
|
5825 * 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
|
5826 * 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
|
5827 * 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
|
5828 * 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
|
5829 * 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
|
5830 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5831 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, unsigned long icon, HTREEITEM 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
|
5832 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5833 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
|
5834 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
|
5835 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
|
5836 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5837 if(!item) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5838 item = (HTREEITEM)CMA_FIRST; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5839 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5840 /* 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
|
5841 * 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
|
5842 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5843 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5844 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
|
5845 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5846 /* 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
|
5847 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5848 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
|
5849 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5850 /* 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
|
5851 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5852 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
|
5853 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
|
5854 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
|
5855 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5856 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
|
5857 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
|
5858 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5859 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
|
5860 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5861 ri.cb = sizeof(RECORDINSERT); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5862 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
|
5863 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
|
5864 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
|
5865 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
|
5866 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
|
5867 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5868 /* 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
|
5869 * 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
|
5870 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5871 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
|
5872 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5873 /* 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
|
5874 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
|
5875 |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5876 return (HTREEITEM)pci; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5877 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
5878 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5879 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5880 * 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
|
5881 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5882 * 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
|
5883 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5884 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5885 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5886 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5887 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5888 HTREEITEM API dw_tree_insert(HWND handle, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5889 { |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5890 return dw_tree_insert_after(handle, (HTREEITEM)CMA_END, title, icon, parent, itemdata); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5891 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5892 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
5893 /* |
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
|
5894 * 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
|
5895 * 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
|
5896 * 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
|
5897 * 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
|
5898 * 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
|
5899 * 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
|
5900 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5901 void API dw_tree_set(HWND handle, HTREEITEM item, char *title, unsigned long 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
|
5902 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5903 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
|
5904 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5905 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
|
5906 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
|
5907 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5908 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
|
5909 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
|
5910 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5911 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
|
5912 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
|
5913 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5914 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
|
5915 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5916 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
|
5917 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5918 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5919 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5920 * 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
|
5921 * 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
|
5922 * 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
|
5923 * 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
|
5924 * 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
|
5925 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5926 void API dw_tree_set_data(HWND handle, HTREEITEM item, void *itemdata) |
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
|
5927 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5928 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
|
5929 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5930 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
|
5931 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
|
5932 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5933 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
|
5934 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5935 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5936 /* |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5937 * Gets the item data of a tree item. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5938 * Parameters: |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5939 * handle: Handle to the tree containing the item. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5940 * item: Handle of the item to be modified. |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5941 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5942 void * API dw_tree_get_data(HWND handle, HTREEITEM item) |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5943 { |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5944 PCNRITEM pci = (PCNRITEM)item; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5945 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5946 if(!pci) |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5947 return NULL; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5948 return pci->user; |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5949 } |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5950 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
5951 /* |
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
|
5952 * 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
|
5953 * 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
|
5954 * 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
|
5955 * 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
|
5956 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5957 void API dw_tree_item_select(HWND handle, HTREEITEM item) |
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
|
5958 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5959 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
|
5960 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5961 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
|
5962 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5963 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
|
5964 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
|
5965 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
|
5966 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5967 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
|
5968 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
5969 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
|
5970 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5971 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5972 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5973 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5974 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5975 * 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
|
5976 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5977 void API dw_tree_clear(HWND handle) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5978 { |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
5979 dw_container_clear(handle, TRUE); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5980 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5981 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
5982 /* |
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
|
5983 * 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
|
5984 * 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
|
5985 * 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
|
5986 * 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
|
5987 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5988 void API dw_tree_expand(HWND handle, HTREEITEM item) |
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
|
5989 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5990 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
|
5991 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5992 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5993 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
5994 * 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
|
5995 * 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
|
5996 * 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
|
5997 * 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
|
5998 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
5999 void API dw_tree_collapse(HWND handle, HTREEITEM item) |
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
|
6000 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6001 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
|
6002 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6003 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6004 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6005 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6006 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6007 * 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
|
6008 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6009 */ |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6010 void API dw_tree_delete(HWND handle, HTREEITEM item) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6011 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6012 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
|
6013 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6014 if(!item) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6015 return; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6016 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6017 if(pci->rc.pszIcon) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6018 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6019 free(pci->rc.pszIcon); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6020 pci->rc.pszIcon = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6021 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6022 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6023 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
|
6024 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6025 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6026 /* 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
|
6027 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
|
6028 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
|
6029 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
|
6030 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
|
6031 } ContainerInfo; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6032 |
3 | 6033 /* |
6034 * Sets up the container columns. | |
6035 * Parameters: | |
6036 * handle: Handle to the container to be configured. | |
6037 * flags: An array of unsigned longs with column flags. | |
6038 * titles: An array of strings with column text titles. | |
6039 * count: The number of columns (this should match the arrays). | |
6040 * separator: The column number that contains the main separator. | |
6041 * (this item may only be used in OS/2) | |
6042 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6043 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
3 | 6044 { |
6045 PFIELDINFO details, first, left = NULL; | |
6046 FIELDINFOINSERT detin; | |
6047 CNRINFO cnri; | |
6048 int z; | |
6049 ULONG size = sizeof(RECORDCORE); | |
6050 ULONG *offStruct = malloc(count * sizeof(ULONG)); | |
6051 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
|
6052 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
|
6053 ULONG *oldflags = blah ? blah->data : 0; |
3 | 6054 |
6055 if(!offStruct || !tempflags) | |
6056 return FALSE; | |
6057 | |
6058 memcpy(tempflags, flags, count * sizeof(ULONG)); | |
6059 tempflags[count] = 0; | |
6060 | |
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
|
6061 blah->data = tempflags; |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6062 blah->flags = separator; |
3 | 6063 |
6064 if(oldflags) | |
6065 free(oldflags); | |
6066 | |
6067 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL) | |
6068 { | |
6069 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE)); | |
6070 } | |
6071 | |
6072 /* Figure out the offsets to the items in the struct */ | |
6073 for(z=0;z<count;z++) | |
6074 { | |
6075 offStruct[z] = size; | |
6076 if(flags[z] & DW_CFA_BITMAPORICON) | |
6077 size += sizeof(HPOINTER); | |
6078 else if(flags[z] & DW_CFA_STRING) | |
6079 size += sizeof(char *); | |
6080 else if(flags[z] & DW_CFA_ULONG) | |
6081 size += sizeof(ULONG); | |
6082 else if(flags[z] & DW_CFA_DATE) | |
6083 size += sizeof(CDATE); | |
6084 else if(flags[z] & DW_CFA_TIME) | |
6085 size += sizeof(CTIME); | |
6086 } | |
6087 | |
6088 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L); | |
6089 | |
6090 if(!first) | |
6091 { | |
6092 free(offStruct); | |
6093 return FALSE; | |
6094 } | |
6095 | |
6096 for(z=0;z<count;z++) | |
6097 { | |
6098 if(z==separator-1) | |
6099 left=details; | |
6100 details->cb = sizeof(FIELDINFO); | |
6101 details->flData = flags[z]; | |
6102 details->flTitle = CFA_FITITLEREADONLY; | |
6103 details->pTitleData = titles[z]; | |
6104 details->offStruct = offStruct[z]; | |
6105 details = details->pNextFieldInfo; | |
6106 } | |
6107 | |
6108 detin.cb = sizeof(FIELDINFOINSERT); | |
6109 detin.fInvalidateFieldInfo = FALSE; | |
6110 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST; | |
6111 detin.cFieldInfoInsert = (ULONG)count; | |
6112 | |
6113 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin)); | |
6114 | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
6115 if(count > separator && separator > 0) |
3 | 6116 { |
6117 cnri.cb = sizeof(CNRINFO); | |
6118 cnri.pFieldInfoLast = left; | |
6119 cnri.xVertSplitbar = 150; | |
6120 | |
6121 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR)); | |
6122 } | |
6123 | |
310
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6124 cnri.flWindowAttr = CV_DETAIL | CV_MINI | CA_DETAILSVIEWTITLES; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6125 cnri.slBitmapOrIcon.cx = 16; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6126 cnri.slBitmapOrIcon.cy = 16; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6127 |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6128 WinSendMsg(handle, CM_SETCNRINFO, &cnri, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON)); |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6129 |
3 | 6130 free(offStruct); |
6131 return TRUE; | |
6132 } | |
6133 | |
6134 /* | |
6135 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
6136 * Parameters: | |
6137 * handle: Handle to the container to be configured. | |
6138 * flags: An array of unsigned longs with column flags. | |
6139 * titles: An array of strings with column text titles. | |
6140 * count: The number of columns (this should match the arrays). | |
6141 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6142 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
3 | 6143 { |
6144 char **newtitles = malloc(sizeof(char *) * (count + 2)); | |
6145 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); | |
6146 | |
6147 newtitles[0] = "Icon"; | |
6148 newtitles[1] = "Filename"; | |
6149 | |
6150 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR; | |
6151 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | |
6152 | |
6153 memcpy(&newtitles[2], titles, sizeof(char *) * count); | |
6154 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); | |
6155 | |
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
|
6156 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0); |
3 | 6157 |
6158 free(newtitles); | |
6159 free(newflags); | |
6160 return TRUE; | |
6161 } | |
6162 | |
6163 /* | |
6164 * Obtains an icon from a module (or header in GTK). | |
6165 * Parameters: | |
6166 * module: Handle to module (DLL) in OS/2 and Windows. | |
6167 * id: A unsigned long id int the resources on OS/2 and | |
6168 * Windows, on GTK this is converted to a pointer | |
6169 * to an embedded XPM. | |
6170 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6171 unsigned long API dw_icon_load(unsigned long module, unsigned long id) |
3 | 6172 { |
6173 return WinLoadPointer(HWND_DESKTOP,module,id); | |
6174 } | |
6175 | |
6176 /* | |
257
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6177 * Obtains an icon from a file. |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6178 * Parameters: |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6179 * filename: Name of the file, omit extention to have |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6180 * DW pick the appropriate file extension. |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6181 * (ICO on OS/2 or Windows, XPM on Unix) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6182 */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6183 unsigned long API dw_icon_load_from_file(char *filename) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6184 { |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6185 char *file = alloca(strlen(filename) + 5); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6186 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6187 if(!file) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6188 return 0; |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6189 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6190 strcpy(file, filename); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6191 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6192 /* check if we can read from this file (it exists and read permission) */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6193 if(access(file, 04) != 0) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6194 { |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6195 /* Try with .bmp extention */ |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6196 strcat(file, ".ico"); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6197 if(access(file, 04) != 0) |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6198 return 0; |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6199 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6200 return WinLoadFileIcon(file, FALSE); |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6201 } |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6202 |
9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
241
diff
changeset
|
6203 /* |
3 | 6204 * Frees a loaded resource in OS/2 and Windows. |
6205 * Parameters: | |
6206 * handle: Handle to icon returned by dw_icon_load(). | |
6207 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6208 void API dw_icon_free(unsigned long handle) |
3 | 6209 { |
6210 WinDestroyPointer(handle); | |
6211 } | |
6212 | |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6213 /* A "safe" WinSendMsg() that tries multiple times in case the |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6214 * queue is blocked for one reason or another. |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6215 */ |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6216 MRESULT _dw_send_msg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, int failure) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6217 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6218 MRESULT res; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6219 int z = 0; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6220 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6221 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6222 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6223 z++; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6224 if(z > 5000000) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6225 return (MRESULT)failure; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6226 dw_main_sleep(1); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6227 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6228 return res; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6229 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6230 |
3 | 6231 /* |
6232 * Allocates memory used to populate a container. | |
6233 * Parameters: | |
6234 * handle: Handle to the container window (widget). | |
6235 * rowcount: The number of items to be populated. | |
6236 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6237 void * API dw_container_alloc(HWND handle, int rowcount) |
3 | 6238 { |
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
|
6239 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
|
6240 ULONG *flags = wd ? wd->data : 0; |
3 | 6241 int z, size = 0, totalsize, count = 0; |
6242 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
|
6243 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
|
6244 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
|
6245 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6246 if(!flags || rowcount < 1) |
3 | 6247 return NULL; |
6248 | |
6249 while(flags[count]) | |
6250 count++; | |
6251 | |
6252 /* Figure out the offsets to the items in the struct */ | |
6253 for(z=0;z<count;z++) | |
6254 { | |
6255 if(flags[z] & DW_CFA_BITMAPORICON) | |
6256 size += sizeof(HPOINTER); | |
6257 else if(flags[z] & DW_CFA_STRING) | |
6258 size += sizeof(char *); | |
6259 else if(flags[z] & DW_CFA_ULONG) | |
6260 size += sizeof(ULONG); | |
6261 else if(flags[z] & DW_CFA_DATE) | |
6262 size += sizeof(CDATE); | |
6263 else if(flags[z] & DW_CFA_TIME) | |
6264 size += sizeof(CTIME); | |
6265 } | |
6266 | |
6267 totalsize = size + sizeof(RECORDCORE); | |
6268 | |
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
|
6269 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
|
6270 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6271 if(!(blah = (void *)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount), 0))) |
3 | 6272 return NULL; |
6273 | |
6274 temp = (PRECORDCORE)blah; | |
6275 | |
6276 for(z=0;z<rowcount;z++) | |
6277 { | |
6278 temp->cb = totalsize; | |
6279 temp = temp->preccNextRecord; | |
6280 } | |
6281 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6282 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
|
6283 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6284 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
|
6285 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
|
6286 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
|
6287 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6288 return (void *)ci; |
3 | 6289 } |
6290 | |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6291 /* Internal function that does the work for set_item and change_item */ |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6292 void _dw_container_set_item(HWND handle, PRECORDCORE temp, int column, int row, void *data) |
3 | 6293 { |
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
|
6294 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
|
6295 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
|
6296 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
|
6297 CNRINFO cnr; |
3 | 6298 void *dest; |
6299 | |
6300 if(!flags) | |
6301 return; | |
6302 | |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6303 if(!_dw_send_msg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0)) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6304 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6305 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6306 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
|
6307 |
3 | 6308 /* Figure out the offsets to the items in the struct */ |
6309 for(z=0;z<column;z++) | |
6310 { | |
6311 if(flags[z] & DW_CFA_BITMAPORICON) | |
6312 size += sizeof(HPOINTER); | |
6313 else if(flags[z] & DW_CFA_STRING) | |
6314 size += sizeof(char *); | |
6315 else if(flags[z] & DW_CFA_ULONG) | |
6316 size += sizeof(ULONG); | |
6317 else if(flags[z] & DW_CFA_DATE) | |
6318 size += sizeof(CDATE); | |
6319 else if(flags[z] & DW_CFA_TIME) | |
6320 size += sizeof(CTIME); | |
6321 } | |
6322 | |
6323 totalsize = size + sizeof(RECORDCORE); | |
6324 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6325 for(z=0;z<(row-currentcount);z++) |
3 | 6326 temp = temp->preccNextRecord; |
6327 | |
6328 dest = (void *)(((ULONG)temp)+((ULONG)totalsize)); | |
6329 | |
6330 if(flags[column] & DW_CFA_BITMAPORICON) | |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6331 memcpy(dest, data, sizeof(HPOINTER)); |
3 | 6332 else if(flags[column] & DW_CFA_STRING) |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6333 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6334 char **newstr = (char **)data, **str = dest; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6335 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6336 if(*str) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6337 free(*str); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6338 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6339 if(newstr && *newstr) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6340 *str = strdup(*newstr); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6341 else |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6342 *str = NULL; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6343 } |
3 | 6344 else if(flags[column] & DW_CFA_ULONG) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6345 memcpy(dest, data, sizeof(ULONG)); |
3 | 6346 else if(flags[column] & DW_CFA_DATE) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6347 memcpy(dest, data, sizeof(CDATE)); |
3 | 6348 else if(flags[column] & DW_CFA_TIME) |
328
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6349 memcpy(dest, data, sizeof(CTIME)); |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6350 } |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6351 |
e00aff2b899e
Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
326
diff
changeset
|
6352 /* Internal function that free()s any strings allocated for a container item */ |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6353 void _dw_container_free_strings(HWND handle, PRECORDCORE temp) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6354 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6355 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6356 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6357 int z, count = 0; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6358 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6359 if(!flags) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6360 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6361 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6362 while(flags[count]) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6363 count++; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6364 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6365 /* Figure out the offsets to the items in the struct */ |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6366 for(z=0;z<count;z++) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6367 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6368 if(flags[z] & DW_CFA_BITMAPORICON) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6369 size += sizeof(HPOINTER); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6370 else if(flags[z] & DW_CFA_STRING) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6371 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6372 char **str; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6373 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6374 totalsize = size + sizeof(RECORDCORE); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6375 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6376 str = (char **)(((ULONG)temp)+((ULONG)totalsize)); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6377 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6378 if(*str) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6379 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6380 free(*str); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6381 *str = NULL; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6382 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6383 size += sizeof(char *); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6384 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6385 else if(flags[z] & DW_CFA_ULONG) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6386 size += sizeof(ULONG); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6387 else if(flags[z] & DW_CFA_DATE) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6388 size += sizeof(CDATE); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6389 else if(flags[z] & DW_CFA_TIME) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6390 size += sizeof(CTIME); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6391 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6392 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6393 |
3 | 6394 /* |
6395 * Sets an item in specified row and column to the given data. | |
6396 * Parameters: | |
6397 * handle: Handle to the container window (widget). | |
6398 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6399 * column: Zero based column of data being set. | |
6400 * row: Zero based row of data being set. | |
6401 * data: Pointer to the data to be added. | |
6402 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6403 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6404 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6405 ContainerInfo *ci = (ContainerInfo *)pointer; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6406 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6407 if(!ci) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6408 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6409 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6410 _dw_container_set_item(handle, (PRECORDCORE)ci->data, column, row, data); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6411 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6412 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6413 /* |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6414 * Changes an existing item in specified row and column to the given data. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6415 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6416 * handle: Handle to the container window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6417 * column: Zero based column of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6418 * row: Zero based row of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6419 * data: Pointer to the data to be added. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6420 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6421 void API dw_container_change_item(HWND handle, int column, int row, void *data) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6422 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6423 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6424 int count = 0; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6425 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6426 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6427 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6428 if(count == row) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6429 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6430 _dw_container_set_item(handle, pCore, column, 0, data); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6431 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6432 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6433 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6434 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6435 count++; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6436 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6437 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6438 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6439 /* |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6440 * Sets an item in specified row and column to the given data. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6441 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6442 * handle: Handle to the container window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6443 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6444 * column: Zero based column of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6445 * row: Zero based row of data being set. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6446 * data: Pointer to the data to be added. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6447 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6448 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) |
3 | 6449 { |
6450 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); | |
6451 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); | |
6452 } | |
6453 | |
6454 /* | |
6455 * Sets an item in specified row and column to the given data. | |
6456 * Parameters: | |
6457 * handle: Handle to the container window (widget). | |
6458 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6459 * column: Zero based column of data being set. | |
6460 * row: Zero based row of data being set. | |
6461 * data: Pointer to the data to be added. | |
6462 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6463 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
3 | 6464 { |
6465 dw_container_set_item(handle, pointer, column + 2, row, data); | |
6466 } | |
6467 | |
6468 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6469 * 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
|
6470 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6471 * 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
|
6472 * 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
|
6473 * 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
|
6474 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6475 void API dw_container_set_column_width(HWND handle, int column, int width) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6476 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6477 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6478 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6479 /* |
3 | 6480 * Sets the title of a row in the container. |
6481 * Parameters: | |
6482 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6483 * row: Zero based row of data being set. | |
6484 * title: String title of the item. | |
6485 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6486 void API dw_container_set_row_title(void *pointer, int row, char *title) |
3 | 6487 { |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6488 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
|
6489 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
|
6490 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
|
6491 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
|
6492 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6493 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6494 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6495 |
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
|
6496 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
|
6497 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6498 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6499 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6500 if(!_dw_send_msg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0)) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6501 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6502 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6503 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
|
6504 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6505 for(z=0;z<(row-currentcount);z++) |
3 | 6506 temp = temp->preccNextRecord; |
6507 | |
6508 temp->pszIcon = title; | |
6509 temp->pszName = title; | |
6510 temp->pszText = title; | |
6511 } | |
6512 | |
6513 /* | |
6514 * Sets the title of a row in the container. | |
6515 * Parameters: | |
6516 * handle: Handle to the container window (widget). | |
6517 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6518 * rowcount: The number of rows to be inserted. | |
6519 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6520 void API dw_container_insert(HWND handle, void *pointer, int rowcount) |
3 | 6521 { |
6522 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
|
6523 ContainerInfo *ci = (ContainerInfo *)pointer; |
3 | 6524 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6525 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6526 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6527 |
3 | 6528 recin.cb = sizeof(RECORDINSERT); |
6529 recin.pRecordOrder = (PRECORDCORE)CMA_END; | |
6530 recin.pRecordParent = NULL; | |
6531 recin.zOrder = CMA_TOP; | |
6532 recin.fInvalidateRecord = TRUE; | |
6533 recin.cRecordsInsert = rowcount; | |
6534 | |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6535 _dw_send_msg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin), 0); |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6536 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6537 free(ci); |
3 | 6538 } |
6539 | |
6540 /* | |
6541 * Removes all rows from a container. | |
6542 * Parameters: | |
6543 * 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
|
6544 * 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
|
6545 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6546 void API dw_container_clear(HWND handle, int redraw) |
3 | 6547 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6548 PCNRITEM pCore; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6549 int container = (int)dw_window_get_data(handle, "_dw_container"); |
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
|
6550 |
315
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
6551 if(hwndEmph == handle) |
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
6552 _clear_emphasis(); |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6553 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6554 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6555 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6556 while(pCore) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6557 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6558 if(container) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6559 _dw_container_free_strings(handle, (PRECORDCORE)pCore); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6560 else |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6561 { |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6562 /* Free icon text */ |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6563 if(pCore->rc.pszIcon) |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6564 { |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6565 free(pCore->rc.pszIcon); |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6566 pCore->rc.pszIcon = 0; |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6567 } |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6568 } |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6569 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6570 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6571 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE), -1); |
3 | 6572 } |
6573 | |
6574 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6575 * 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
|
6576 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6577 * 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
|
6578 * 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
|
6579 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6580 void API dw_container_delete(HWND handle, int rowcount) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6581 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6582 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount); |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6583 int current = 1; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6584 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6585 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
|
6586 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6587 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
|
6588 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6589 _dw_container_free_strings(handle, last); |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6590 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
|
6591 current++; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6592 } |
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
|
6593 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6594 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | 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
|
6595 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6596 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
|
6597 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6598 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6599 /* |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6600 * 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
|
6601 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6602 * 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
|
6603 * 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
|
6604 * 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
|
6605 * 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
|
6606 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6607 void API dw_container_scroll(HWND handle, int direction, long rows) |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6608 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6609 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
|
6610 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6611 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
|
6612 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
|
6613 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6614 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
|
6615 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
|
6616 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6617 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6618 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6619 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6620 /* |
3 | 6621 * Starts a new query of a container. |
6622 * Parameters: | |
6623 * handle: Handle to the window (widget) to be queried. | |
6624 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6625 * return items that are currently selected. Otherwise | |
6626 * it will return all records in the container. | |
6627 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6628 char * API dw_container_query_start(HWND handle, unsigned long flags) |
3 | 6629 { |
6630 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | |
6631 if(pCore) | |
6632 { | |
6633 if(flags) | |
6634 { | |
6635 while(pCore) | |
6636 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6637 if(pCore->flRecordAttr & flags) |
3 | 6638 return pCore->pszIcon; |
6639 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6640 } | |
6641 } | |
6642 else | |
6643 return pCore->pszIcon; | |
6644 } | |
6645 return NULL; | |
6646 } | |
6647 | |
6648 /* | |
6649 * Continues an existing query of a container. | |
6650 * Parameters: | |
6651 * handle: Handle to the window (widget) to be queried. | |
6652 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6653 * return items that are currently selected. Otherwise | |
6654 * it will return all records in the container. | |
6655 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6656 char * API dw_container_query_next(HWND handle, unsigned long flags) |
3 | 6657 { |
6658 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6659 if(pCore) | |
6660 { | |
6661 if(flags) | |
6662 { | |
6663 while(pCore) | |
6664 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6665 if(pCore->flRecordAttr & flags) |
3 | 6666 return pCore->pszIcon; |
6667 | |
6668 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6669 } | |
6670 } | |
6671 else | |
6672 return pCore->pszIcon; | |
6673 } | |
6674 return NULL; | |
6675 } | |
6676 | |
6677 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6678 * 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
|
6679 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6680 * 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
|
6681 * 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
|
6682 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6683 void API dw_container_cursor(HWND handle, char *text) |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6684 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6685 RECTL viewport, item; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6686 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6687 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
|
6688 while(pCore) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6689 { |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
6690 if((char *)pCore->pszIcon == text) |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6691 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6692 QUERYRECORDRECT qrr; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6693 int scrollpixels = 0, midway; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6694 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6695 qrr.cb = sizeof(QUERYRECORDRECT); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6696 qrr.pRecord = pCore; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6697 qrr.fRightSplitWindow = 0; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6698 qrr.fsExtent = CMA_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6699 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6700 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
|
6701 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
|
6702 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
|
6703 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6704 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
|
6705 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
|
6706 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6707 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
|
6708 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6709 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6710 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6711 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
|
6712 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6713 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6714 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6715 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6716 * Deletes the item with the text speficied. |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6717 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6718 * handle: Handle to the window (widget). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6719 * text: Text usually returned by dw_container_query(). |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6720 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6721 void API dw_container_delete_row(HWND handle, char *text) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6722 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6723 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6724 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6725 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6726 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6727 if((char *)pCore->pszIcon == text) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6728 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6729 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6730 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6731 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6732 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6733 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6734 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6735 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6736 /* |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6737 * 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
|
6738 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6739 * 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
|
6740 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6741 void API dw_container_optimize(HWND handle) |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6742 { |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6743 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
|
6744 RECTL item; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6745 PRECORDCORE pCore = NULL; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6746 int max = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6747 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6748 if(blah && !blah->flags) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6749 return; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6750 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6751 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
|
6752 while(pCore) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6753 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6754 QUERYRECORDRECT qrr; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6755 int vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6756 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6757 qrr.cb = sizeof(QUERYRECORDRECT); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6758 qrr.pRecord = pCore; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6759 qrr.fRightSplitWindow = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6760 qrr.fsExtent = CMA_TEXT; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6761 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6762 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
|
6763 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6764 vector = item.xRight - item.xLeft; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6765 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6766 if(vector > max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6767 max = vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6768 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6769 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
|
6770 } |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6771 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6772 if(max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6773 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6774 CNRINFO cnri; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6775 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6776 cnri.cb = sizeof(CNRINFO); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6777 cnri.xVertSplitbar = max; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6778 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6779 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
|
6780 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6781 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6782 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6783 /* |
3 | 6784 * Creates a rendering context widget (window) to be packed. |
6785 * Parameters: | |
6786 * id: An id to be used with dw_window_from_id. | |
6787 * Returns: | |
6788 * A handle to the widget or NULL on failure. | |
6789 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6790 HWND API dw_render_new(unsigned long id) |
3 | 6791 { |
6792 HWND hwndframe = WinCreateWindow(HWND_OBJECT, | |
6793 WC_FRAME, | |
6794 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
|
6795 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
|
6796 FS_NOBYTEALIGN, |
3 | 6797 0,0,2000,1000, |
6798 NULLHANDLE, | |
6799 HWND_TOP, | |
6800 id, | |
6801 NULL, | |
6802 NULL); | |
6803 WinSubclassWindow(hwndframe, _RendProc); | |
6804 return hwndframe; | |
6805 } | |
6806 | |
6807 /* Sets the current foreground drawing color. | |
6808 * Parameters: | |
6809 * red: red value. | |
6810 * green: green value. | |
6811 * blue: blue value. | |
6812 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6813 void API dw_color_foreground_set(unsigned long value) |
3 | 6814 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6815 _foreground = value; |
3 | 6816 } |
6817 | |
6818 /* Sets the current background drawing color. | |
6819 * Parameters: | |
6820 * red: red value. | |
6821 * green: green value. | |
6822 * blue: blue value. | |
6823 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6824 void API dw_color_background_set(unsigned long value) |
3 | 6825 { |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6826 _background = value; |
3 | 6827 } |
6828 | |
6829 HPS _set_hps(HPS hps) | |
6830 { | |
225
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
6831 LONG alTable[2]; |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
6832 |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
6833 alTable[0] = DW_RED_VALUE(_foreground) << 16 | DW_GREEN_VALUE(_foreground) << 8 | DW_BLUE_VALUE(_foreground); |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
6834 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background); |
3 | 6835 |
6836 GpiCreateLogColorTable(hps, | |
225
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
6837 LCOL_RESET, |
3 | 6838 LCOLF_CONSECRGB, |
225
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
6839 16, |
413710a835eb
Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
224
diff
changeset
|
6840 2, |
3 | 6841 alTable); |
192
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6842 if(_foreground & DW_RGB_COLOR) |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6843 GpiSetColor(hps, 16); |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6844 else |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6845 GpiSetColor(hps, _internal_color(_foreground)); |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6846 if(_background & DW_RGB_COLOR) |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6847 GpiSetBackColor(hps, 17); |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6848 else |
d946e329670c
Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
190
diff
changeset
|
6849 GpiSetBackColor(hps, _internal_color(_background)); |
3 | 6850 return hps; |
6851 } | |
6852 | |
6853 HPS _set_colors(HWND handle) | |
6854 { | |
6855 HPS hps = WinGetPS(handle); | |
6856 | |
6857 _set_hps(hps); | |
6858 return hps; | |
6859 } | |
6860 | |
6861 /* Draw a point on a window (preferably a render window). | |
6862 * Parameters: | |
6863 * handle: Handle to the window. | |
6864 * pixmap: Handle to the pixmap. (choose only one of these) | |
6865 * x: X coordinate. | |
6866 * y: Y coordinate. | |
6867 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6868 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
3 | 6869 { |
6870 HPS hps; | |
6871 int height; | |
6872 POINTL ptl; | |
6873 | |
6874 if(handle) | |
6875 { | |
6876 hps = _set_colors(handle); | |
6877 height = _get_height(handle); | |
6878 } | |
6879 else if(pixmap) | |
6880 { | |
6881 hps = _set_hps(pixmap->hps); | |
6882 height = pixmap->height; | |
6883 } | |
6884 else | |
6885 return; | |
6886 | |
6887 ptl.x = x; | |
6888 ptl.y = height - y - 1; | |
6889 | |
6890 GpiSetPel(hps, &ptl); | |
6891 if(!pixmap) | |
6892 WinReleasePS(hps); | |
6893 } | |
6894 | |
6895 /* Draw a line on a window (preferably a render window). | |
6896 * Parameters: | |
6897 * handle: Handle to the window. | |
6898 * pixmap: Handle to the pixmap. (choose only one of these) | |
6899 * x1: First X coordinate. | |
6900 * y1: First Y coordinate. | |
6901 * x2: Second X coordinate. | |
6902 * y2: Second Y coordinate. | |
6903 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6904 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
3 | 6905 { |
6906 HPS hps; | |
6907 int height; | |
6908 POINTL ptl[2]; | |
6909 | |
6910 if(handle) | |
6911 { | |
6912 hps = _set_colors(handle); | |
6913 height = _get_height(handle); | |
6914 } | |
6915 else if(pixmap) | |
6916 { | |
6917 hps = _set_hps(pixmap->hps); | |
6918 height = pixmap->height; | |
6919 } | |
6920 else | |
6921 return; | |
6922 | |
6923 ptl[0].x = x1; | |
6924 ptl[0].y = height - y1 - 1; | |
6925 ptl[1].x = x2; | |
6926 ptl[1].y = height - y2 - 1; | |
6927 | |
6928 GpiMove(hps, &ptl[0]); | |
6929 GpiLine(hps, &ptl[1]); | |
6930 | |
6931 if(!pixmap) | |
6932 WinReleasePS(hps); | |
6933 } | |
6934 | |
6935 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6936 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
|
6937 { |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6938 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
|
6939 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
|
6940 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
|
6941 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6942 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
|
6943 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6944 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
|
6945 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6946 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
|
6947 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
|
6948 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
|
6949 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6950 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
|
6951 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
|
6952 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6953 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
|
6954 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
|
6955 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
|
6956 } |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6957 |
3 | 6958 /* Draw text on a window (preferably a render window). |
6959 * Parameters: | |
6960 * handle: Handle to the window. | |
6961 * pixmap: Handle to the pixmap. (choose only one of these) | |
6962 * x: X coordinate. | |
6963 * y: Y coordinate. | |
6964 * text: Text to be displayed. | |
6965 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6966 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) |
3 | 6967 { |
6968 HPS hps; | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6969 int z, height; |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6970 RECTL rcl; |
3 | 6971 char fontname[128]; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6972 POINTL aptl[TXTBOX_COUNT]; |
3 | 6973 |
6974 if(handle) | |
6975 { | |
6976 hps = _set_colors(handle); | |
6977 height = _get_height(handle); | |
6978 _GetPPFont(handle, fontname); | |
6979 } | |
6980 else if(pixmap) | |
6981 { | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
6982 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
|
6983 |
3 | 6984 hps = _set_hps(pixmap->hps); |
6985 height = pixmap->height; | |
6986 _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
|
6987 _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
|
6988 WinReleasePS(pixmaphps); |
3 | 6989 } |
6990 else | |
6991 return; | |
6992 | |
6993 for(z=0;z<strlen(fontname);z++) | |
6994 { | |
6995 if(fontname[z]=='.') | |
6996 break; | |
6997 } | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6998 |
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
6999 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); |
3 | 7000 |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7001 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
|
7002 rcl.yTop = height - y; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7003 rcl.yBottom = rcl.yTop - (aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y); |
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7004 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x); |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7005 |
376
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7006 if(_background == DW_CLR_DEFAULT) |
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7007 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7008 else |
b812cf360e49
dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
369
diff
changeset
|
7009 WinDrawText(hps, -1, text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); |
3 | 7010 |
7011 if(!pixmap) | |
7012 WinReleasePS(hps); | |
7013 } | |
7014 | |
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
|
7015 /* 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
|
7016 * 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
|
7017 * 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
|
7018 * 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
|
7019 * 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
|
7020 * 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
|
7021 * 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
|
7022 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7023 void API dw_font_text_extents(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height) |
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
|
7024 { |
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
|
7025 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
|
7026 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
|
7027 |
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
|
7028 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
|
7029 { |
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
|
7030 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
|
7031 } |
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
|
7032 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
|
7033 { |
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
|
7034 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
|
7035 |
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
|
7036 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
|
7037 _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
|
7038 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
|
7039 } |
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
|
7040 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
|
7041 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
|
7042 |
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
|
7043 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
|
7044 |
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
|
7045 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
|
7046 *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
|
7047 |
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
|
7048 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
|
7049 *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
|
7050 |
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
|
7051 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
|
7052 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
|
7053 } |
3 | 7054 |
7055 /* Draw a rectangle on a window (preferably a render window). | |
7056 * Parameters: | |
7057 * handle: Handle to the window. | |
7058 * pixmap: Handle to the pixmap. (choose only one of these) | |
7059 * fill: Fill box TRUE or FALSE. | |
7060 * x: X coordinate. | |
7061 * y: Y coordinate. | |
7062 * width: Width of rectangle. | |
7063 * height: Height of rectangle. | |
7064 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7065 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) |
3 | 7066 { |
7067 HPS hps; | |
7068 int thisheight; | |
7069 POINTL ptl[2]; | |
7070 | |
7071 if(handle) | |
7072 { | |
7073 hps = _set_colors(handle); | |
7074 thisheight = _get_height(handle); | |
7075 } | |
7076 else if(pixmap) | |
7077 { | |
7078 hps = _set_hps(pixmap->hps); | |
7079 thisheight = pixmap->height; | |
7080 } | |
7081 else | |
7082 return; | |
7083 | |
7084 ptl[0].x = x; | |
7085 ptl[0].y = thisheight - y - 1; | |
7086 ptl[1].x = x + width - 1; | |
7087 ptl[1].y = thisheight - y - height; | |
7088 | |
7089 GpiMove(hps, &ptl[0]); | |
7090 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); | |
7091 | |
7092 if(!pixmap) | |
7093 WinReleasePS(hps); | |
7094 } | |
7095 | |
7096 /* Call this after drawing to the screen to make sure | |
7097 * anything you have drawn is visible. | |
7098 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7099 void API dw_flush(void) |
3 | 7100 { |
7101 } | |
7102 | |
7103 /* | |
7104 * Creates a pixmap with given parameters. | |
7105 * Parameters: | |
7106 * handle: Window handle the pixmap is associated with. | |
7107 * width: Width of the pixmap in pixels. | |
7108 * height: Height of the pixmap in pixels. | |
7109 * depth: Color depth of the pixmap. | |
7110 * Returns: | |
7111 * A handle to a pixmap or NULL on failure. | |
7112 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7113 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
3 | 7114 { |
7115 BITMAPINFOHEADER bmih; | |
7116 SIZEL sizl = { 0, 0 }; | |
7117 HPIXMAP pixmap; | |
7118 HDC hdc; | |
7119 HPS hps; | |
7120 ULONG ulFlags; | |
7121 LONG cPlanes, cBitCount; | |
7122 | |
7123 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7124 return NULL; | |
7125 | |
7126 hps = WinGetPS(handle); | |
7127 | |
7128 hdc = GpiQueryDevice(hps); | |
7129 ulFlags = GpiQueryPS(hps, &sizl); | |
7130 | |
7131 pixmap->handle = handle; | |
7132 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
7133 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
7134 | |
7135 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes); | |
7136 if (!depth) | |
7137 { | |
7138 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount); | |
7139 depth = cBitCount; | |
7140 } | |
7141 | |
7142 memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); | |
7143 bmih.cbFix = sizeof(BITMAPINFOHEADER); | |
7144 bmih.cx = (SHORT)width; | |
7145 bmih.cy = (SHORT)height; | |
7146 bmih.cPlanes = (SHORT)cPlanes; | |
7147 bmih.cBitCount = (SHORT)depth; | |
7148 | |
7149 pixmap->width = width; pixmap->height = height; | |
7150 | |
7151 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL); | |
7152 | |
7153 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
7154 | |
7155 if (depth>8) | |
7156 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL ); | |
7157 | |
7158 WinReleasePS(hps); | |
7159 | |
7160 return pixmap; | |
7161 } | |
7162 | |
7163 /* | |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7164 * Creates a pixmap from a file. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7165 * Parameters: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7166 * handle: Window handle the pixmap is associated with. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7167 * filename: Name of the file, omit extention to have |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7168 * DW pick the appropriate file extension. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7169 * (BMP on OS/2 or Windows, XPM on Unix) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7170 * Returns: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7171 * A handle to a pixmap or NULL on failure. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7172 */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7173 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7174 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7175 HPIXMAP pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7176 char *file = alloca(strlen(filename) + 5); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7177 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7178 if(!file || !(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7179 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7180 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7181 strcpy(file, filename); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7182 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7183 /* check if we can read from this file (it exists and read permission) */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7184 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7185 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7186 /* Try with .bmp extention */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7187 strcat(file, ".bmp"); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7188 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7189 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7190 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7191 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7192 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7193 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7194 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7195 /* Try to load the bitmap from file */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7196 if(!_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height)) |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7197 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7198 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7199 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7200 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7201 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7202 /* Success fill in other values */ |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7203 pixmap->handle = handle; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7204 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7205 return pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7206 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7207 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7208 /* |
3 | 7209 * Creates a pixmap from internal resource graphic specified by id. |
7210 * Parameters: | |
7211 * handle: Window handle the pixmap is associated with. | |
7212 * id: Resource ID associated with requested pixmap. | |
7213 * Returns: | |
7214 * A handle to a pixmap or NULL on failure. | |
7215 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7216 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id) |
3 | 7217 { |
7218 BITMAPINFOHEADER bmih; | |
7219 SIZEL sizl = { 0, 0 }; | |
7220 HPIXMAP pixmap; | |
7221 HDC hdc; | |
7222 HPS hps; | |
7223 ULONG ulFlags; | |
7224 | |
7225 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7226 return NULL; | |
7227 | |
7228 hps = WinGetPS(handle); | |
7229 | |
7230 hdc = GpiQueryDevice(hps); | |
7231 ulFlags = GpiQueryPS(hps, &sizl); | |
7232 | |
7233 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
7234 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
7235 | |
7236 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0); | |
7237 | |
7238 GpiQueryBitmapParameters(pixmap->hbm, &bmih); | |
7239 | |
7240 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
7241 | |
7242 pixmap->width = bmih.cx; pixmap->height = bmih.cy; | |
7243 | |
7244 WinReleasePS(hps); | |
7245 | |
7246 return pixmap; | |
7247 } | |
7248 | |
7249 /* | |
7250 * Destroys an allocated pixmap. | |
7251 * Parameters: | |
7252 * pixmap: Handle to a pixmap returned by | |
7253 * dw_pixmap_new.. | |
7254 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7255 void API dw_pixmap_destroy(HPIXMAP pixmap) |
3 | 7256 { |
7257 GpiSetBitmap(pixmap->hps, NULLHANDLE); | |
7258 GpiDeleteBitmap(pixmap->hbm); | |
7259 GpiAssociate(pixmap->hps, NULLHANDLE); | |
7260 GpiDestroyPS(pixmap->hps); | |
7261 DevCloseDC(pixmap->hdc); | |
7262 free(pixmap); | |
7263 } | |
7264 | |
7265 /* | |
7266 * Copies from one item to another. | |
7267 * Parameters: | |
7268 * dest: Destination window handle. | |
7269 * destp: Destination pixmap. (choose only one). | |
7270 * xdest: X coordinate of destination. | |
7271 * ydest: Y coordinate of destination. | |
7272 * width: Width of area to copy. | |
7273 * height: Height of area to copy. | |
7274 * src: Source window handle. | |
7275 * srcp: Source pixmap. (choose only one). | |
7276 * xsrc: X coordinate of source. | |
7277 * ysrc: Y coordinate of source. | |
7278 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7279 void API dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc) |
3 | 7280 { |
7281 HPS hpsdest; | |
7282 HPS hpssrc; | |
7283 POINTL ptl[4]; | |
7284 int destheight, srcheight; | |
7285 | |
7286 if(dest) | |
7287 { | |
7288 hpsdest = WinGetPS(dest); | |
7289 destheight = _get_height(dest); | |
7290 } | |
7291 else if(destp) | |
7292 { | |
7293 hpsdest = destp->hps; | |
7294 destheight = destp->height; | |
7295 } | |
7296 else | |
7297 return; | |
7298 | |
7299 if(src) | |
7300 { | |
7301 hpssrc = WinGetPS(src); | |
7302 srcheight = _get_height(src); | |
7303 } | |
7304 else if(srcp) | |
7305 { | |
7306 hpssrc = srcp->hps; | |
7307 srcheight = srcp->height; | |
7308 } | |
7309 else | |
7310 { | |
7311 if(!destp) | |
7312 WinReleasePS(hpsdest); | |
7313 return; | |
7314 } | |
7315 | |
7316 ptl[0].x = xdest; | |
7317 ptl[0].y = (destheight - ydest) - height; | |
7318 ptl[1].x = ptl[0].x + width; | |
7319 ptl[1].y = destheight - ydest; | |
7320 ptl[2].x = xsrc; | |
7321 ptl[2].y = srcheight - (ysrc + height); | |
7322 ptl[3].x = ptl[2].x + width; | |
7323 ptl[3].y = ptl[2].y + height; | |
7324 | |
7325 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE); | |
7326 | |
7327 if(!destp) | |
7328 WinReleasePS(hpsdest); | |
7329 if(!srcp) | |
7330 WinReleasePS(hpssrc); | |
7331 } | |
7332 | |
7333 /* | |
7334 * Emits a beep. | |
7335 * Parameters: | |
7336 * freq: Frequency. | |
7337 * dur: Duration. | |
7338 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7339 void API dw_beep(int freq, int dur) |
3 | 7340 { |
7341 DosBeep(freq, dur); | |
7342 } | |
7343 | |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7344 /* Open a shared library and return a handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7345 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7346 * name: Base name of the shared library. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7347 * handle: Pointer to a module handle, |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7348 * will be filled in with the handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7349 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7350 int API dw_module_load(char *name, HMOD *handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7351 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7352 char objnamebuf[300] = ""; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7353 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7354 return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7355 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7356 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7357 /* Queries the address of a symbol within open handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7358 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7359 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7360 * name: Name of the symbol you want the address of. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7361 * func: A pointer to a function pointer, to obtain |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7362 * the address. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7363 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7364 int API dw_module_symbol(HMOD handle, char *name, void**func) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7365 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7366 return DosQueryProcAddr(handle, 0, name, (PFN*)func); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7367 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7368 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7369 /* Frees the shared library previously opened. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7370 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7371 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7372 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7373 int API dw_module_close(HMOD handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7374 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7375 DosFreeModule(handle); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7376 return 0; |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7377 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7378 |
3 | 7379 /* |
7380 * Returns the handle to an unnamed mutex semaphore. | |
7381 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7382 HMTX API dw_mutex_new(void) |
3 | 7383 { |
7384 HMTX mutex; | |
7385 | |
7386 DosCreateMutexSem(NULL, &mutex, 0, FALSE); | |
7387 return mutex; | |
7388 } | |
7389 | |
7390 /* | |
7391 * Closes a semaphore created by dw_mutex_new(). | |
7392 * Parameters: | |
7393 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7394 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7395 void API dw_mutex_close(HMTX mutex) |
3 | 7396 { |
7397 DosCloseMutexSem(mutex); | |
7398 } | |
7399 | |
7400 /* | |
7401 * 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
|
7402 * 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
|
7403 * while blocking. |
3 | 7404 * Parameters: |
7405 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7406 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7407 void API dw_mutex_lock(HMTX mutex) |
3 | 7408 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7409 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
|
7410 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7411 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
|
7412 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7413 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
|
7414 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7415 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
|
7416 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
|
7417 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7418 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7419 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7420 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT); |
3 | 7421 } |
7422 | |
7423 /* | |
7424 * Reliquishes the access to the semaphore. | |
7425 * Parameters: | |
7426 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7427 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7428 void API dw_mutex_unlock(HMTX mutex) |
3 | 7429 { |
7430 DosReleaseMutexSem(mutex); | |
7431 } | |
7432 | |
7433 /* | |
7434 * Returns the handle to an unnamed event semaphore. | |
7435 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7436 HEV API dw_event_new(void) |
3 | 7437 { |
7438 HEV blah; | |
7439 | |
7440 if(DosCreateEventSem (NULL, &blah, 0L, FALSE)) | |
7441 return 0; | |
7442 | |
7443 return blah; | |
7444 } | |
7445 | |
7446 /* | |
7447 * Resets a semaphore created by dw_event_new(). | |
7448 * Parameters: | |
7449 * eve: The handle to the event returned by dw_event_new(). | |
7450 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7451 int API dw_event_reset(HEV eve) |
3 | 7452 { |
7453 ULONG count; | |
7454 | |
7455 if(DosResetEventSem(eve, &count)) | |
7456 return FALSE; | |
7457 return TRUE; | |
7458 } | |
7459 | |
7460 /* | |
7461 * Posts a semaphore created by dw_event_new(). Causing all threads | |
7462 * waiting on this event in dw_event_wait to continue. | |
7463 * Parameters: | |
7464 * eve: The handle to the event returned by dw_event_new(). | |
7465 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7466 int API dw_event_post(HEV eve) |
3 | 7467 { |
7468 if(DosPostEventSem(eve)) | |
7469 return FALSE; | |
7470 return TRUE; | |
7471 } | |
7472 | |
7473 | |
7474 /* | |
7475 * Waits on a semaphore created by dw_event_new(), until the | |
7476 * event gets posted or until the timeout expires. | |
7477 * Parameters: | |
7478 * eve: The handle to the event returned by dw_event_new(). | |
7479 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7480 int API dw_event_wait(HEV eve, unsigned long timeout) |
3 | 7481 { |
7482 int rc = DosWaitEventSem(eve, timeout); | |
7483 if(!rc) | |
7484 return 1; | |
7485 if(rc == ERROR_TIMEOUT) | |
7486 return -1; | |
7487 return 0; | |
7488 } | |
7489 | |
7490 /* | |
7491 * Closes a semaphore created by dw_event_new(). | |
7492 * Parameters: | |
7493 * eve: The handle to the event returned by dw_event_new(). | |
7494 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7495 int API dw_event_close(HEV *eve) |
3 | 7496 { |
7497 if(!eve || ~DosCloseEventSem(*eve)) | |
7498 return FALSE; | |
7499 return TRUE; | |
7500 } | |
7501 | |
7502 /* | |
7503 * Encapsulate the message queues on OS/2. | |
7504 */ | |
7505 void _dwthreadstart(void *data) | |
7506 { | |
7507 HAB thishab = WinInitialize(0); | |
7508 HMQ thishmq = WinCreateMsgQueue(dwhab, 0); | |
7509 void (*threadfunc)(void *) = NULL; | |
7510 void **tmp = (void **)data; | |
7511 | |
7512 threadfunc = (void (*)(void *))tmp[0]; | |
7513 threadfunc(tmp[1]); | |
7514 | |
7515 free(tmp); | |
7516 | |
7517 WinDestroyMsgQueue(thishmq); | |
7518 WinTerminate(thishab); | |
7519 } | |
7520 | |
7521 /* | |
7522 * Creates a new thread with a starting point of func. | |
7523 * Parameters: | |
7524 * func: Function which will be run in the new thread. | |
7525 * data: Parameter(s) passed to the function. | |
7526 * stack: Stack size of new thread (OS/2 and Windows only). | |
7527 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7528 DWTID API dw_thread_new(void *func, void *data, int stack) |
3 | 7529 { |
7530 void **tmp = malloc(sizeof(void *) * 2); | |
7531 | |
7532 tmp[0] = func; | |
7533 tmp[1] = data; | |
7534 | |
7535 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp); | |
7536 } | |
7537 | |
7538 /* | |
7539 * Ends execution of current thread immediately. | |
7540 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7541 void API dw_thread_end(void) |
3 | 7542 { |
7543 _endthread(); | |
7544 } | |
7545 | |
7546 /* | |
7547 * Returns the current thread's ID. | |
7548 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7549 DWTID API dw_thread_id(void) |
3 | 7550 { |
7551 return (DWTID)_threadid; | |
7552 } | |
7553 | |
7554 /* | |
7555 * Cleanly terminates a DW session, should be signal handler safe. | |
7556 * Parameters: | |
7557 * exitcode: Exit code reported to the operating system. | |
7558 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7559 void API dw_exit(int exitcode) |
3 | 7560 { |
7561 /* In case we are in a signal handler, don't | |
7562 * try to free memory that could possibly be | |
7563 * free()'d by the runtime already. | |
7564 */ | |
7565 Root = NULL; | |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7566 |
3 | 7567 exit(exitcode); |
7568 } | |
7569 | |
7570 /* | |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7571 * Creates a splitbar window (widget) with given parameters. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7572 * Parameters: |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
7573 * type: Value can be DW_VERT or DW_HORZ. |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7574 * topleft: Handle to the window to be top or left. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7575 * bottomright: Handle to the window to be bottom or right. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7576 * Returns: |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7577 * A handle to a splitbar window or NULL on failure. |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7578 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7579 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7580 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7581 HWND tmp = WinCreateWindow(HWND_OBJECT, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7582 SplitbarClassName, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7583 NULL, |
137
6a18312049fd
The splitbar needs to have the WS_CLIPCHILDREN style set.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
136
diff
changeset
|
7584 WS_VISIBLE | WS_CLIPCHILDREN, |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7585 0,0,2000,1000, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7586 NULLHANDLE, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7587 HWND_TOP, |
119
1cad81b7cc4c
Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
117
diff
changeset
|
7588 id, |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7589 NULL, |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7590 NULL); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7591 if(tmp) |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7592 { |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
7593 HWND tmpbox = dw_box_new(DW_VERT, 0); |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7594 float *percent = malloc(sizeof(float)); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7595 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7596 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7597 WinSetParent(tmpbox, tmp, FALSE); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7598 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7599 |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
7600 tmpbox = dw_box_new(DW_VERT, 0); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7601 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7602 WinSetParent(tmpbox, tmp, FALSE); |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7603 *percent = 50.0; |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7604 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox); |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7605 dw_window_set_data(tmp, "_dw_percent", (void *)percent); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7606 dw_window_set_data(tmp, "_dw_type", (void *)type); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7607 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7608 return tmp; |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7609 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7610 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7611 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7612 * Sets the position of a splitbar (pecentage). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7613 * Parameters: |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7614 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7615 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7616 void API dw_splitbar_set(HWND handle, float percent) |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7617 { |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7618 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent"); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7619 int type = (int)dw_window_get_data(handle, "_dw_type"); |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
7620 unsigned long width, height; |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7621 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7622 if(mypercent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7623 *mypercent = percent; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7624 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7625 dw_window_get_pos_size(handle, NULL, NULL, &width, &height); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7626 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7627 _handle_splitbar_resize(handle, percent, type, width, height); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7628 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7629 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7630 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7631 * Gets the position of a splitbar (pecentage). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7632 * Parameters: |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7633 * handle: The handle to the splitbar returned by dw_splitbar_new(). |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7634 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7635 float API dw_splitbar_get(HWND handle) |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7636 { |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7637 float *percent = (float *)dw_window_get_data(handle, "_dw_percent"); |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7638 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7639 if(percent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7640 return *percent; |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7641 return 0.0; |
3 | 7642 } |
7643 | |
7644 /* | |
7645 * Pack windows (widgets) into a box from the start (or top). | |
7646 * Parameters: | |
7647 * box: Window handle of the box to be packed into. | |
7648 * item: Window handle of the item to be back. | |
7649 * width: Width in pixels of the item or -1 to be self determined. | |
7650 * height: Height in pixels of the item or -1 to be self determined. | |
7651 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
7652 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
7653 * pad: Number of pixels of padding around the item. | |
7654 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7655 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 7656 { |
7657 Box *thisbox; | |
7658 | |
447
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7659 /* |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7660 * If you try and pack an item into itself VERY bad things can happen; like at least an |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7661 * infinite loop on GTK! Lets be safe! |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7662 */ |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7663 if(box == item) |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7664 { |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7665 dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7666 return; |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7667 } |
5a0779561d0f
Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
438
diff
changeset
|
7668 |
3 | 7669 if(WinWindowFromID(box, FID_CLIENT)) |
7670 { | |
7671 box = WinWindowFromID(box, FID_CLIENT); | |
7672 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7673 } | |
7674 else | |
7675 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7676 if(thisbox) | |
7677 { | |
283
54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
280
diff
changeset
|
7678 if(thisbox->type == DW_HORZ) |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7679 _dw_box_pack_end(box, item, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
3 | 7680 else |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7681 _dw_box_pack_start(box, item, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7682 } |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7683 } |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7684 |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7685 void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname) |
3 | 7686 { |
7687 Box *thisbox; | |
7688 | |
7689 if(WinWindowFromID(box, FID_CLIENT)) | |
7690 { | |
7691 box = WinWindowFromID(box, FID_CLIENT); | |
7692 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7693 hsize = TRUE; | |
7694 vsize = TRUE; | |
7695 } | |
7696 else | |
7697 thisbox = WinQueryWindowPtr(box, QWP_USER); | |
7698 if(thisbox) | |
7699 { | |
7700 int z; | |
7701 Item *tmpitem, *thisitem = thisbox->items; | |
7702 char tmpbuf[100]; | |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
7703 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box"); |
3 | 7704 |
7705 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
7706 | |
7707 for(z=0;z<thisbox->count;z++) | |
7708 { | |
7709 tmpitem[z+1] = thisitem[z]; | |
7710 } | |
7711 | |
7712 WinQueryClassName(item, 99, tmpbuf); | |
7713 | |
298
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7714 if(vsize && !height) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7715 height = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7716 if(hsize && !width) |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7717 width = 1; |
caed245ea8a1
Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
293
diff
changeset
|
7718 |
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
|
7719 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 7720 tmpitem[0].type = TYPEBOX; |
7721 else | |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7722 { |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7723 if ( width == 0 && hsize == FALSE ) |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7724 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item); |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7725 if ( height == 0 && vsize == FALSE ) |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7726 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item); |
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7727 |
3 | 7728 tmpitem[0].type = TYPEITEM; |
438
fac2afe7bda3
Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
429
diff
changeset
|
7729 } |
3 | 7730 |
7731 tmpitem[0].hwnd = item; | |
7732 tmpitem[0].origwidth = tmpitem[0].width = width; | |
7733 tmpitem[0].origheight = tmpitem[0].height = height; | |
7734 tmpitem[0].pad = pad; | |
7735 if(hsize) | |
7736 tmpitem[0].hsize = SIZEEXPAND; | |
7737 else | |
7738 tmpitem[0].hsize = SIZESTATIC; | |
7739 | |
7740 if(vsize) | |
7741 tmpitem[0].vsize = SIZEEXPAND; | |
7742 else | |
7743 tmpitem[0].vsize = SIZESTATIC; | |
7744 | |
7745 thisbox->items = tmpitem; | |
7746 | |
7747 if(thisbox->count) | |
7748 free(thisitem); | |
7749 | |
7750 thisbox->count++; | |
7751 | |
7752 WinQueryClassName(item, 99, tmpbuf); | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
7753 /* Don't set the ownership if it's an entryfield or spinbutton */ |
408
fecd529ba9d4
Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
406
diff
changeset
|
7754 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0) |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7755 WinSetOwner(item, box); |
405
4c084ec3e176
Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
404
diff
changeset
|
7756 WinSetParent(frame ? frame : item, box, FALSE); |
3 | 7757 } |
7758 } | |
7759 | |
7760 /* The following two functions graciously contributed by Peter Nielsen. */ | |
7761 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) { | |
7762 char* pchStart = pchBuffer; | |
7763 char* pchEnd = pchStart + ulSize - 2; | |
7764 | |
7765 while (pchEnd >= pchStart) | |
7766 { | |
7767 if ((pchEnd[0] == '#') && (pchEnd[1] == '@')) | |
7768 { | |
7769 *pchEnd-- = '\0'; | |
7770 while (pchEnd >= pchStart) | |
7771 { | |
7772 if ((pchEnd[0] == '@') && (pchEnd[1] == '#')) | |
7773 { | |
7774 ULONG ulMajor = 0; | |
7775 ULONG ulMinor = 0; | |
7776 | |
7777 char* pch = pchEnd + 2; | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
7778 while (!isdigit ((int)*pch) && *pch) |
3 | 7779 pch++; |
7780 | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
7781 while (isdigit ((int)*pch)) |
3 | 7782 ulMajor = ulMajor * 10 + *pch++ - '0'; |
7783 | |
7784 if (*pch == '.') | |
7785 { | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
7786 while (isdigit ((int)*++pch)) |
3 | 7787 ulMinor = ulMinor * 10 + *pch - '0'; |
7788 } | |
7789 return ((ulMajor << 16) | ulMinor); | |
7790 } | |
7791 pchEnd--; | |
7792 } | |
7793 } | |
7794 pchEnd--; | |
7795 } | |
7796 return (0); | |
7797 } | |
7798 | |
7799 ULONG _GetSystemBuildLevel(void) { | |
7800 /* 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. | |
7801 * 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. | |
7802 */ | |
7803 ULONG ulBootDrive = 0; | |
7804 ULONG ulBuild = 0; | |
7805 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR) | |
7806 { | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7807 char achFileName[11] = "C:\\OS2KRNL"; |
3 | 7808 HFILE hfile; |
7809 ULONG ulResult; | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7810 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7811 achFileName[0] = (char)('A'+ulBootDrive-1); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7812 |
3 | 7813 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) |
7814 { | |
7815 ULONG ulFileSize = 0; | |
7816 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR) | |
7817 { | |
7818 const ULONG ulFirstTry = min (256, ulFileSize); | |
7819 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR) | |
7820 { | |
7821 char *pchBuffer = malloc(ulFirstTry); | |
7822 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR) | |
7823 { | |
7824 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry); | |
7825 if (ulBuild == 0) | |
7826 { | |
7827 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR) | |
7828 { | |
7829 free(pchBuffer); | |
7830 pchBuffer = malloc(ulFileSize); | |
7831 | |
7832 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR) | |
7833 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize); | |
7834 } | |
7835 } | |
7836 } | |
7837 free(pchBuffer); | |
7838 } | |
7839 } | |
7840 DosClose (hfile); | |
7841 } | |
7842 } | |
7843 return (ulBuild); | |
7844 } | |
7845 | |
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
|
7846 /* |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7847 * 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
|
7848 * 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
|
7849 * 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
|
7850 * 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
|
7851 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7852 void API dw_window_default(HWND window, HWND defaultitem) |
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
|
7853 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7854 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
|
7855 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
|
7856 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7857 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
|
7858 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
|
7859 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
|
7860 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
7861 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
|
7862 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
|
7863 } |
3 | 7864 |
7865 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7866 * 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
|
7867 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7868 * 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
|
7869 * 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
|
7870 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7871 void API dw_window_click_default(HWND window, HWND next) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7872 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7873 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
|
7874 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
7875 if(blah) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7876 blah->clickdefault = next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7877 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7878 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
7879 /* |
3 | 7880 * Returns some information about the current operating environment. |
7881 * Parameters: | |
7882 * env: Pointer to a DWEnv struct. | |
7883 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7884 void API dw_environment_query(DWEnv *env) |
3 | 7885 { |
7886 ULONG Build; | |
7887 | |
7888 if(!env) | |
7889 return; | |
7890 | |
7891 /* The default is OS/2 2.0 */ | |
7892 strcpy(env->osName,"OS/2"); | |
7893 env->MajorVersion = 2; | |
7894 env->MinorVersion = 0; | |
7895 | |
7896 Build = _GetSystemBuildLevel(); | |
7897 env->MinorBuild = Build & 0xFFFF; | |
7898 env->MajorBuild = Build >> 16; | |
7899 | |
7900 if (aulBuffer[0] == 20) | |
7901 { | |
7902 int i = (unsigned int)aulBuffer[1]; | |
7903 if (i > 20) | |
7904 { | |
7905 strcpy(env->osName,"Warp"); | |
7906 env->MajorVersion = (int)i/10; | |
7907 env->MinorVersion = i-(((int)i/10)*10); | |
7908 } | |
7909 else if (i == 10) | |
7910 env->MinorVersion = 1; | |
7911 } | |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
7912 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
|
7913 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
|
7914 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
|
7915 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
|
7916 env->DWSubVersion = DW_SUB_VERSION; |
3 | 7917 } |
7918 | |
7919 /* | |
7920 * Opens a file dialog and queries user selection. | |
7921 * Parameters: | |
7922 * title: Title bar text for dialog. | |
7923 * defpath: The default path of the open dialog. | |
7924 * ext: Default file extention. | |
7925 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
7926 * Returns: | |
7927 * NULL on error. A malloced buffer containing | |
7928 * the file path on success. | |
7929 * | |
7930 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7931 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) |
3 | 7932 { |
7933 FILEDLG fild; | |
7934 HWND hwndFile; | |
7935 int len; | |
7936 | |
7937 if(defpath) | |
7938 strcpy(fild.szFullFile, defpath); | |
7939 else | |
7940 strcpy(fild.szFullFile, ""); | |
7941 | |
7942 len = strlen(fild.szFullFile); | |
7943 | |
7944 if(len) | |
7945 { | |
7946 if(fild.szFullFile[len-1] != '\\') | |
7947 strcat(fild.szFullFile, "\\"); | |
7948 } | |
7949 strcat(fild.szFullFile, "*"); | |
7950 | |
7951 if(ext) | |
7952 { | |
7953 strcat(fild.szFullFile, "."); | |
7954 strcat(fild.szFullFile, ext); | |
7955 } | |
7956 | |
7957 fild.cbSize = sizeof(FILEDLG); | |
7958 fild.fl = /*FDS_HELPBUTTON |*/ FDS_CENTER | FDS_OPEN_DIALOG; | |
7959 fild.pszTitle = title; | |
7960 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open"); | |
7961 fild.ulUser = 0L; | |
7962 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc; | |
7963 fild.lReturn = 0L; | |
7964 fild.lSRC = 0L; | |
7965 fild.hMod = 0; | |
7966 fild.x = 0; | |
7967 fild.y = 0; | |
7968 fild.pszIType = (PSZ)NULL; | |
7969 fild.papszITypeList = (PAPSZ)NULL; | |
236
5592cdeb29cf
Make sure all platforms have the same typedefs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
235
diff
changeset
|
7970 fild.pszIDrive = (PSZ)NULL; |
3 | 7971 fild.papszIDriveList= (PAPSZ)NULL; |
7972 fild.sEAType = (SHORT)0; | |
7973 fild.papszFQFilename= (PAPSZ)NULL; | |
7974 fild.ulFQFCount = 0L; | |
7975 | |
7976 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild); | |
7977 if(hwndFile) | |
7978 { | |
7979 switch(fild.lReturn) | |
7980 { | |
7981 case DID_OK: | |
7982 return strdup(fild.szFullFile); | |
7983 case DID_CANCEL: | |
7984 return NULL; | |
7985 } | |
7986 } | |
7987 return NULL; | |
7988 } | |
7989 | |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7990 /* Internal function to set drive and directory */ |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7991 int _SetPath(char *path) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7992 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
7993 #ifndef __WATCOMC__ |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7994 if(strlen(path) > 2) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7995 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7996 if(path[1] == ':') |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7997 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7998 char drive = toupper(path[0]); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
7999 _chdrive((drive - 'A')+1); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8000 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8001 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8002 #endif |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8003 return chdir(path); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8004 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8005 |
3 | 8006 /* |
8007 * Execute and external program in a seperate session. | |
8008 * Parameters: | |
8009 * program: Program name with optional path. | |
8010 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
8011 * params: An array of pointers to string arguements. | |
8012 * Returns: | |
8013 * -1 on error. | |
8014 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8015 int API dw_exec(char *program, int type, char **params) |
3 | 8016 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8017 return spawnvp(P_NOWAIT, program, (const char **)params); |
3 | 8018 } |
8019 | |
8020 /* | |
8021 * Loads a web browser pointed at the given URL. | |
8022 * Parameters: | |
8023 * url: Uniform resource locator. | |
8024 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8025 int API dw_browse(char *url) |
3 | 8026 { |
8027 /* Is there a way to find the webbrowser in Unix? */ | |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8028 char *execargs[3], browser[1024], *olddir, *newurl = NULL; |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8029 int len, ret; |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8030 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8031 olddir = _getcwd(NULL, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8032 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8033 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8034 "DefaultWorkingDir", NULL, browser, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8035 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8036 if(browser[0]) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8037 _SetPath(browser); |
3 | 8038 |
8039 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", | |
8040 "DefaultBrowserExe", NULL, browser, 1024); | |
8041 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8042 len = strlen(browser) - strlen("explore.exe"); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8043 |
3 | 8044 execargs[0] = browser; |
8045 execargs[1] = url; | |
8046 execargs[2] = NULL; | |
8047 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8048 /* 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
|
8049 * 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
|
8050 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8051 if(len > 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8052 { |
356
fb2667339e9f
Guess I should probably make sure they are trying to load a file
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
350
diff
changeset
|
8053 if(stricmp(&browser[len], "explore.exe") == 0 && stricmp(url, "file://") == 0) |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8054 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8055 int newlen, z; |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8056 newurl = malloc(strlen(url) + 2); |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8057 sprintf(newurl, "file:///%s", &url[7]); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8058 newlen = strlen(newurl); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8059 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
|
8060 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8061 if(newurl[z] == '|') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8062 newurl[z] = ':'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8063 if(newurl[z] == '/') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8064 newurl[z] = '\\'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8065 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8066 execargs[1] = newurl; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8067 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8068 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8069 |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8070 ret = dw_exec(browser, DW_EXEC_GUI, execargs); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8071 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8072 if(olddir) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8073 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8074 _SetPath(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8075 free(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8076 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8077 if(newurl) |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8078 free(newurl); |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8079 return ret; |
3 | 8080 } |
8081 | |
8082 /* | |
8083 * Returns a pointer to a static buffer which containes the | |
8084 * current user directory. Or the root directory (C:\ on | |
8085 * OS/2 and Windows). | |
8086 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8087 char * API dw_user_dir(void) |
3 | 8088 { |
8089 static char _user_dir[1024] = ""; | |
8090 | |
8091 if(!_user_dir[0]) | |
8092 { | |
8093 char *home = getenv("HOME"); | |
8094 | |
8095 if(home) | |
8096 strcpy(_user_dir, home); | |
8097 else | |
8098 strcpy(_user_dir, "C:\\"); | |
8099 } | |
8100 return _user_dir; | |
8101 } | |
8102 | |
8103 /* | |
8104 * Call a function from the window (widget)'s context. | |
8105 * Parameters: | |
8106 * handle: Window handle of the widget. | |
8107 * function: Function pointer to be called. | |
8108 * data: Pointer to the data to be passed to the function. | |
8109 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8110 void API dw_window_function(HWND handle, void *function, void *data) |
3 | 8111 { |
8112 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data); | |
8113 } | |
8114 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8115 /* 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
|
8116 * 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
|
8117 * 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
|
8118 */ |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8119 UserData *_find_userdata(UserData **root, char *varname) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8120 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8121 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
|
8122 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8123 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
|
8124 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8125 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
|
8126 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
|
8127 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
|
8128 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8129 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
|
8130 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8131 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8132 int _new_userdata(UserData **root, char *varname, void *data) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8133 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8134 UserData *new = _find_userdata(root, varname); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8135 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8136 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
|
8137 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8138 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
|
8139 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
|
8140 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8141 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8142 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8143 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
|
8144 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
|
8145 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8146 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
|
8147 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
|
8148 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8149 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
|
8150 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8151 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
|
8152 *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
|
8153 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8154 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8155 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
|
8156 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
|
8157 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8158 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
|
8159 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
|
8160 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8161 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
|
8162 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
|
8163 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8164 *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
|
8165 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8166 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
|
8167 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8168 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8169 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
|
8170 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8171 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8172 int _remove_userdata(UserData **root, char *varname, int all) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8173 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8174 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
|
8175 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8176 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
|
8177 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8178 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
|
8179 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8180 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
|
8181 { |
147
b479002e013f
Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
137
diff
changeset
|
8182 *root = tmp->next; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8183 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
|
8184 free(tmp); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8185 if(!all) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8186 return 0; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8187 tmp = *root; |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8188 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8189 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8190 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8191 /* If all is true we should |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8192 * never get here. |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8193 */ |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8194 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
|
8195 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
|
8196 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
|
8197 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
|
8198 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8199 } |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8200 else |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8201 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8202 prev = tmp; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8203 tmp = tmp->next; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8204 } |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8205 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8206 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
|
8207 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8208 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8209 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8210 * 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
|
8211 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8212 * 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
|
8213 * 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
|
8214 * 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
|
8215 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8216 void API dw_window_set_data(HWND window, char *dataname, void *data) |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8217 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8218 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
|
8219 |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8220 if(!blah) |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8221 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8222 if(!dataname) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8223 return; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8224 |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8225 blah = calloc(1, sizeof(WindowData)); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8226 WinSetWindowPtr(window, QWP_USER, blah); |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8227 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8228 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8229 if(data) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8230 _new_userdata(&(blah->root), dataname, data); |
117
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8231 else |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8232 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8233 if(dataname) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8234 _remove_userdata(&(blah->root), dataname, FALSE); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8235 else |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8236 _remove_userdata(&(blah->root), NULL, TRUE); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8237 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8238 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8239 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8240 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8241 * 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
|
8242 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8243 * 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
|
8244 * 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
|
8245 * 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
|
8246 */ |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8247 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
|
8248 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8249 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
|
8250 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8251 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
|
8252 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8253 UserData *ud = _find_userdata(&(blah->root), dataname); |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8254 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
|
8255 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
|
8256 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8257 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
|
8258 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8259 |
3 | 8260 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8261 * Add a callback to a timer event. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8262 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8263 * interval: Milliseconds to delay between calls. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8264 * sigfunc: The pointer to the function to be used as the callback. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8265 * data: User data to be passed to the handler function. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8266 * Returns: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8267 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8268 */ |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8269 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8270 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8271 if(sigfunc) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8272 { |
289
0e6f09149eaa
Fixed some EMX warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
8273 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval); |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8274 |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8275 if(timerid) |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8276 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8277 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data); |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8278 return timerid; |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8279 } |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8280 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8281 return 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8282 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8283 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8284 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8285 * Removes timer callback. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8286 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8287 * id: Timer ID returned by dw_timer_connect(). |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8288 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8289 void API dw_timer_disconnect(int id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8290 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8291 SignalHandler *prev = NULL, *tmp = Root; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8292 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8293 /* 0 is an invalid timer ID */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8294 if(!id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8295 return; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8296 |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8297 WinStopTimer(dwhab, NULLHANDLE, id); |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8298 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8299 while(tmp) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8300 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8301 if(tmp->id == id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8302 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8303 if(prev) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8304 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8305 prev->next = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8306 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8307 tmp = prev->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8308 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8309 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8310 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8311 Root = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8312 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8313 tmp = Root; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8314 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8315 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8316 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8317 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8318 prev = tmp; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8319 tmp = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8320 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8321 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8322 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8323 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8324 /* |
3 | 8325 * Add a callback to a window event. |
8326 * Parameters: | |
8327 * window: Window handle of signal to be called back. | |
8328 * signame: A string pointer identifying which signal to be hooked. | |
8329 * sigfunc: The pointer to the function to be used as the callback. | |
8330 * data: User data to be passed to the handler function. | |
8331 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8332 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) |
3 | 8333 { |
8334 ULONG message = 0L; | |
8335 | |
8336 if(window && signame && sigfunc) | |
8337 { | |
8338 if((message = _findsigmessage(signame)) != 0) | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8339 _new_signal(message, window, 0, sigfunc, data); |
3 | 8340 } |
8341 } | |
8342 | |
8343 /* | |
8344 * Removes callbacks for a given window with given name. | |
8345 * Parameters: | |
8346 * window: Window handle of callback to be removed. | |
8347 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8348 void API dw_signal_disconnect_by_name(HWND window, char *signame) |
3 | 8349 { |
8350 SignalHandler *prev = NULL, *tmp = Root; | |
8351 ULONG message; | |
8352 | |
8353 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | |
8354 return; | |
8355 | |
8356 while(tmp) | |
8357 { | |
8358 if(tmp->window == window && tmp->message == message) | |
8359 { | |
8360 if(prev) | |
8361 { | |
8362 prev->next = tmp->next; | |
8363 free(tmp); | |
8364 tmp = prev->next; | |
8365 } | |
8366 else | |
8367 { | |
8368 Root = tmp->next; | |
8369 free(tmp); | |
8370 tmp = Root; | |
8371 } | |
8372 } | |
8373 else | |
8374 { | |
8375 prev = tmp; | |
8376 tmp = tmp->next; | |
8377 } | |
8378 } | |
8379 } | |
8380 | |
8381 /* | |
8382 * Removes all callbacks for a given window. | |
8383 * Parameters: | |
8384 * window: Window handle of callback to be removed. | |
8385 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8386 void API dw_signal_disconnect_by_window(HWND window) |
3 | 8387 { |
8388 SignalHandler *prev = NULL, *tmp = Root; | |
8389 | |
8390 while(tmp) | |
8391 { | |
8392 if(tmp->window == window) | |
8393 { | |
8394 if(prev) | |
8395 { | |
8396 prev->next = tmp->next; | |
8397 free(tmp); | |
8398 tmp = prev->next; | |
8399 } | |
8400 else | |
8401 { | |
8402 Root = tmp->next; | |
8403 free(tmp); | |
8404 tmp = Root; | |
8405 } | |
8406 } | |
8407 else | |
8408 { | |
8409 prev = tmp; | |
8410 tmp = tmp->next; | |
8411 } | |
8412 } | |
8413 } | |
8414 | |
8415 /* | |
8416 * Removes all callbacks for a given window with specified data. | |
8417 * Parameters: | |
8418 * window: Window handle of callback to be removed. | |
8419 * data: Pointer to the data to be compared against. | |
8420 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8421 void API dw_signal_disconnect_by_data(HWND window, void *data) |
3 | 8422 { |
8423 SignalHandler *prev = NULL, *tmp = Root; | |
8424 | |
8425 while(tmp) | |
8426 { | |
8427 if(tmp->window == window && tmp->data == data) | |
8428 { | |
8429 if(prev) | |
8430 { | |
8431 prev->next = tmp->next; | |
8432 free(tmp); | |
8433 tmp = prev->next; | |
8434 } | |
8435 else | |
8436 { | |
8437 Root = tmp->next; | |
8438 free(tmp); | |
8439 tmp = Root; | |
8440 } | |
8441 } | |
8442 else | |
8443 { | |
8444 prev = tmp; | |
8445 tmp = tmp->next; | |
8446 } | |
8447 } | |
8448 } | |
8449 | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8450 |