Mercurial > dwindows
annotate os2/dw.c @ 545:11e3d5e3543c
COlumn offsets for filesystem containers in OS/2 is 2; not 1.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 04 Apr 2004 04:12:50 +0000 |
parents | 8217ee5c254e |
children | dac29596615d |
rev | line source |
---|---|
3 | 1 /* |
2 * Dynamic Windows: | |
3 * A GTK like implementation of the PM GUI | |
4 * | |
516
caa7ed17c132
Updated copyrights and license file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
5 * (C) 2000-2004 Brian Smith <dbsoft@technologist.com> |
caa7ed17c132
Updated copyrights and license file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
514
diff
changeset
|
6 * (C) 2003-2004 Mark Hessling <m.hessling@qut.edu.au> |
3 | 7 * (C) 2000 Achim Hasenmueller <achimha@innotek.de> |
8 * (C) 2000 Peter Nielsen <peter@pmview.com> | |
9 * (C) 1998 Sergey I. Yevtushenko (some code borrowed from cell toolkit) | |
10 * | |
11 */ | |
12 #define INCL_DOS | |
13 #define INCL_DOSERRORS | |
14 #define INCL_WIN | |
15 #define INCL_GPI | |
16 | |
17 #include <os2.h> | |
18 #include <stdlib.h> | |
19 #include <string.h> | |
20 #include <stdio.h> | |
21 #include <stdarg.h> | |
22 #include <stddef.h> | |
23 #include <ctype.h> | |
24 #include <process.h> | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
25 #include <time.h> |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
26 #include <io.h> |
171
b8e93557b2c7
EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
170
diff
changeset
|
27 #ifndef __EMX__ |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
28 #include <direct.h> |
171
b8e93557b2c7
EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
170
diff
changeset
|
29 #endif |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
30 #include <sys/time.h> |
3 | 31 #include "dw.h" |
32 | |
33 #define QWP_USER 0 | |
34 | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
35 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
36 MRESULT EXPENTRY _wndproc(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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname); |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
42 void _free_menu_data(HWND menu); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
43 |
3 | 44 char ClassName[] = "dynamicwindows"; |
45 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
|
46 char *DefaultFont = "9.WarpSans"; |
3 | 47 |
48 HAB dwhab = 0; | |
49 HMQ dwhmq = 0; | |
50 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
|
51 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT; |
3 | 52 |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
53 HWND hwndApp = NULLHANDLE, hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
54 PRECORDCORE pCoreEmph = NULL; |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
55 ULONG aulBuffer[4], GlobalID = 10000; |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
56 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
|
57 |
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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 }; |
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
|
76 |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
77 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) |
3 | 78 |
79 #ifndef min | |
80 #define min(a, b) (((a < b) ? a : b)) | |
81 #endif | |
82 | |
83 typedef struct _sighandler | |
84 { | |
85 struct _sighandler *next; | |
86 ULONG message; | |
87 HWND window; | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
88 int id; |
3 | 89 void *signalfunction; |
90 void *data; | |
91 | |
92 } SignalHandler; | |
93 | |
94 SignalHandler *Root = NULL; | |
95 | |
96 typedef struct | |
97 { | |
98 ULONG message; | |
99 char name[30]; | |
100 | |
101 } SignalList; | |
102 | |
103 /* List of signals and their equivilent OS/2 message */ | |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
104 #define SIGNALMAX 16 |
3 | 105 |
106 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
|
107 { 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
|
108 { 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
|
109 { 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
|
110 { 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
|
111 { 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
|
112 { 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
|
113 { 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
|
114 { 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
|
115 { 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
|
116 { 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
|
117 { 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
|
118 { 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
|
119 { 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
|
120 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED }, |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
121 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE }, |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
122 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND } |
3 | 123 }; |
124 | |
125 /* This function adds a signal handler callback into the linked list. | |
126 */ | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
127 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data) |
3 | 128 { |
129 SignalHandler *new = malloc(sizeof(SignalHandler)); | |
130 | |
131 new->message = message; | |
132 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
|
133 new->id = id; |
3 | 134 new->signalfunction = signalfunction; |
135 new->data = data; | |
136 new->next = NULL; | |
137 | |
138 if (!Root) | |
139 Root = new; | |
140 else | |
141 { | |
142 SignalHandler *prev = NULL, *tmp = Root; | |
143 while(tmp) | |
144 { | |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
145 if(tmp->message == message && |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
146 tmp->window == window && |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
147 tmp->id == id && |
68
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
148 tmp->signalfunction == signalfunction) |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
149 { |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
150 tmp->data = data; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
151 free(new); |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
152 return; |
8d6100960adf
Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
67
diff
changeset
|
153 } |
3 | 154 prev = tmp; |
155 tmp = tmp->next; | |
156 } | |
157 if(prev) | |
158 prev->next = new; | |
159 else | |
160 Root = new; | |
161 } | |
162 } | |
163 | |
164 /* Finds the message number for a given signal name */ | |
165 ULONG _findsigmessage(char *signame) | |
166 { | |
167 int z; | |
168 | |
169 for(z=0;z<SIGNALMAX;z++) | |
170 { | |
171 if(stricmp(signame, SignalTranslate[z].name) == 0) | |
172 return SignalTranslate[z].message; | |
173 } | |
174 return 0L; | |
175 } | |
176 | |
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
|
177 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
|
178 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
179 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
|
180 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
|
181 PVOID user; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
182 HTREEITEM 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
|
183 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
184 } 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
|
185 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
186 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
187 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
|
188 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
189 window = window; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
190 key = key; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
191 data = data; /* keep compiler happy */ |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
192 return TRUE; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
193 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
194 |
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 /* 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
|
196 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
|
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 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
|
199 |
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 /* Find the toplevel window */ |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
201 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
|
202 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
203 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
|
204 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
205 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
|
206 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
|
207 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
|
208 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
209 |
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
|
210 |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
211 /* Returns height of specified window. */ |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
212 int _get_height(HWND handle) |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
213 { |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
214 unsigned long height; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
215 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
216 return (int)height; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
217 } |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
218 |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
219 /* Find the height of the frame a desktop style window is sitting on */ |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
220 int _get_frame_height(HWND handle) |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
221 { |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
222 while(handle) |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
223 { |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
224 HWND client; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
225 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE) |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
226 { |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
227 return _get_height(WinQueryWindow(handle, QW_PARENT)); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
228 } |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
229 handle = WinQueryWindow(handle, QW_PARENT); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
230 } |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
231 return dw_screen_height(); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
232 } |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
233 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
234 /* A "safe" WinSendMsg() that tries multiple times in case the |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
235 * queue is blocked for one reason or another. |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
236 */ |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
237 MRESULT _dw_send_msg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, int failure) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
238 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
239 MRESULT res; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
240 int z = 0; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
241 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
242 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
243 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
244 z++; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
245 if(z > 5000000) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
246 return (MRESULT)failure; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
247 dw_main_sleep(1); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
248 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
249 return res; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
250 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
251 |
156 | 252 /* Return the entryfield child of a window */ |
253 HWND _find_entryfield(HWND handle) | |
254 { | |
255 HENUM henum; | |
256 HWND child, entry = 0; | |
257 | |
258 henum = WinBeginEnumWindows(handle); | |
259 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
260 { | |
261 char tmpbuf[100]; | |
262 | |
263 WinQueryClassName(child, 99, tmpbuf); | |
264 | |
265 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */ | |
266 { | |
267 entry = child; | |
268 break; | |
269 } | |
270 } | |
271 WinEndEnumWindows(henum); | |
272 return entry; | |
273 } | |
274 | |
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
|
275 /* 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
|
276 * 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
|
277 */ |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
278 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
|
279 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
280 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
|
281 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
|
282 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
283 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
|
284 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
|
285 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
286 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
|
287 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
288 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
|
289 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
290 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
|
291 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
|
292 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
|
293 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
|
294 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
295 _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
|
296 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
297 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
|
298 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
|
299 } |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
300 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
301 /* 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
|
302 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
|
303 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
304 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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
310 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
311 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
|
312 |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
313 if(disable) |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
314 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
|
315 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
316 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
|
317 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
318 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
|
319 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
|
320 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
|
321 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
322 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
323 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
|
324 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
|
325 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
326 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
|
327 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
|
328 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
329 |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
330 /* This function removes any handlers on windows and frees |
3 | 331 * the user memory allocated to it. |
332 */ | |
333 void _free_window_memory(HWND handle) | |
334 { | |
335 HENUM henum; | |
336 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
|
337 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER); |
3 | 338 |
339 dw_signal_disconnect_by_window(handle); | |
340 | |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
341 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
342 _free_menu_data(child); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
343 |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
344 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
|
345 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
346 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
|
347 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
348 if(box) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
349 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
350 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
351 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
352 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
353 WinSetWindowPtr(child, QWP_USER, 0); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
354 free(box); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
355 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
356 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
357 |
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
|
358 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
|
359 { |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
360 WindowData *wd = (WindowData *)ptr; |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
361 char tmpbuf[100]; |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
362 |
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
363 /* 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
|
364 _free_bitmap(handle); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
365 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
366 WinQueryClassName(handle, 99, tmpbuf); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
367 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
368 if(strncmp(tmpbuf, "#1", 3)==0) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
369 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
370 Box *box = (Box *)ptr; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
371 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
372 if(box->count && box->items) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
373 free(box->items); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
374 } |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
375 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
|
376 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
377 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
|
378 |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
379 if(data) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
380 free(data); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
381 } |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
382 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
|
383 { |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
384 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
|
385 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
|
386 { |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
387 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
|
388 |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
389 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
|
390 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
|
391 } |
4029240b5e63
Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
337
diff
changeset
|
392 } |
169
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
393 |
b2211123274e
Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
167
diff
changeset
|
394 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
|
395 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
|
396 |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
397 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
|
398 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
|
399 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
|
400 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
401 |
3 | 402 henum = WinBeginEnumWindows(handle); |
403 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
404 _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
|
405 |
3 | 406 WinEndEnumWindows(henum); |
407 return; | |
408 } | |
409 | |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
410 void _free_menu_data(HWND menu) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
411 { |
470
6ccac112f1e5
Minor formatting changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
468
diff
changeset
|
412 int i, count = (int)WinSendMsg(menu, MM_QUERYITEMCOUNT, 0, 0); |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
413 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
414 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
415 _free_window_memory(menu); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
416 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
417 for(i=0;i<count;i++) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
418 { |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
419 SHORT menuid = (SHORT)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0); |
470
6ccac112f1e5
Minor formatting changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
468
diff
changeset
|
420 MENUITEM mi; |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
421 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
422 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi)) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
423 && mi.hwndSubMenu) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
424 _free_menu_data(mi.hwndSubMenu); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
425 } |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
426 } |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
427 |
3 | 428 /* This function returns 1 if the window (widget) handle |
429 * passed to it is a valid window that can gain input focus. | |
430 */ | |
431 int _validate_focus(HWND handle) | |
432 { | |
433 char tmpbuf[100]; | |
434 | |
435 if(!handle) | |
436 return 0; | |
437 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
438 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
|
439 return 0; |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
440 |
3 | 441 WinQueryClassName(handle, 99, tmpbuf); |
442 | |
443 /* These are the window classes which can | |
444 * obtain input focus. | |
445 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
446 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */ |
3 | 454 return 1; |
455 return 0; | |
456 } | |
457 | |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
458 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) |
3 | 459 { |
538
5c1ee7f6e7ff
More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
537
diff
changeset
|
460 int z; |
3 | 461 static HWND lasthwnd, firsthwnd; |
462 static int finish_searching; | |
463 | |
464 /* Start is 2 when we have cycled completely and | |
465 * need to set the focus to the last widget we found | |
466 * that was valid. | |
467 */ | |
468 if(start == 2) | |
469 { | |
470 if(lasthwnd) | |
471 WinSetFocus(HWND_DESKTOP, lasthwnd); | |
472 return 0; | |
473 } | |
474 | |
475 /* Start is 1 when we are entering the function | |
476 * for the first time, it is zero when entering | |
477 * the function recursively. | |
478 */ | |
479 if(start == 1) | |
480 { | |
481 lasthwnd = handle; | |
482 finish_searching = 0; | |
483 firsthwnd = 0; | |
484 } | |
485 | |
538
5c1ee7f6e7ff
More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
537
diff
changeset
|
486 for(z=box->count-1;z>-1;z--) |
5c1ee7f6e7ff
More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
537
diff
changeset
|
487 { |
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
|
488 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
|
489 { |
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
|
490 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
|
491 |
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 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
|
493 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
|
494 } |
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
|
495 else |
3 | 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 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
|
498 { |
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 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
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 |
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 /* 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
|
507 * 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
|
508 */ |
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
|
509 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
|
510 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
|
511 } |
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
|
512 if(_validate_focus(box->items[z].hwnd)) |
3 | 513 { |
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
|
514 /* 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
|
515 * 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
|
516 */ |
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
|
517 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
|
518 { |
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 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
|
520 { |
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
|
521 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
|
522 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
|
523 } |
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
|
524 } |
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
|
525 |
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
|
526 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
|
527 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
|
528 |
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
|
529 lasthwnd = box->items[z].hwnd; |
3 | 530 } |
531 else | |
532 { | |
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
|
533 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
|
534 |
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
|
535 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
|
536 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
3 | 537 { |
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
|
538 /* 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
|
539 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
|
540 |
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
|
541 if(mybox) |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
542 { |
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
|
543 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
|
544 |
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 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
|
546 return 1; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
547 } |
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
|
548 |
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 /* 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
|
550 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
|
551 |
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 if(mybox) |
3 | 553 { |
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
|
554 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
|
555 |
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 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
|
557 return 1; |
3 | 558 } |
559 } | |
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
|
560 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ |
3 | 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 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
|
563 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
564 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 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
|
565 |
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 if(page) |
3 | 567 { |
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
|
568 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
|
569 |
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 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
|
571 return 1; |
3 | 572 } |
573 } | |
574 } | |
575 } | |
576 } | |
577 return 0; | |
578 } | |
579 | |
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
|
580 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
|
581 { |
538
5c1ee7f6e7ff
More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
537
diff
changeset
|
582 int z; |
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
|
583 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
|
584 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
|
585 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
586 /* 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
|
587 * 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
|
588 * 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
|
589 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
590 if(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
|
591 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
592 if(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
|
593 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
|
594 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
|
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 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
597 /* Start is 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
|
598 * 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
|
599 * 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
|
600 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
601 if(start == 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
|
602 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
603 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
|
604 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
|
605 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
|
606 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
607 |
538
5c1ee7f6e7ff
More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
537
diff
changeset
|
608 for(z=0;z<box->count;z++) |
5c1ee7f6e7ff
More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
537
diff
changeset
|
609 { |
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
|
610 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
|
611 { |
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
|
612 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
|
613 |
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 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
|
615 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
|
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 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
|
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 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
|
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(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
|
622 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
|
623 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
|
624 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
|
625 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
|
626 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
|
627 |
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 /* 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
|
629 * 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
|
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(!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
|
632 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
|
633 } |
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 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
|
635 { |
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
|
636 /* 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
|
637 * 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
|
638 */ |
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
|
639 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
|
640 { |
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
|
641 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
|
642 { |
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
|
643 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
|
644 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
|
645 } |
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
|
646 } |
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
|
647 |
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
|
648 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
|
649 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
|
650 |
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
|
651 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
|
652 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
653 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
|
654 { |
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
|
655 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
|
656 |
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
|
657 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
|
658 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
|
659 { |
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
|
660 /* 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
|
661 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
|
662 |
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
|
663 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
|
664 { |
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
|
665 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
|
666 |
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
|
667 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
|
668 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
|
669 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
670 |
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
|
671 /* 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
|
672 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
|
673 |
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
|
674 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
|
675 { |
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
|
676 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
|
677 |
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
|
678 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
|
679 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
|
680 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
681 } |
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
|
682 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
|
683 { |
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
|
684 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
|
685 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
686 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 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
|
687 |
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
|
688 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
|
689 { |
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
|
690 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
|
691 |
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
|
692 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
|
693 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
|
694 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
695 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
696 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
697 } |
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 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
|
700 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
701 |
3 | 702 /* This function finds the first widget in the |
703 * layout and moves the current focus to it. | |
704 */ | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
705 int _initial_focus(HWND handle) |
3 | 706 { |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
707 Box *thisbox = NULL; |
3 | 708 HWND box; |
709 | |
710 box = WinWindowFromID(handle, FID_CLIENT); | |
711 if(box) | |
712 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
|
713 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
714 return 1; |
3 | 715 |
716 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
|
717 _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
|
718 return 0; |
3 | 719 } |
720 | |
721 /* This function finds the current widget in the | |
722 * layout and moves the current focus to the next item. | |
723 */ | |
724 void _shift_focus(HWND handle) | |
725 { | |
726 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
|
727 HWND box, lastbox = _toplevel_window(handle); |
3 | 728 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
729 box = WinWindowFromID(lastbox, FID_CLIENT); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
730 if(box) |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
731 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
|
732 else |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
733 thisbox = WinQueryWindowPtr(lastbox, QWP_USER); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
734 |
3 | 735 if(thisbox) |
736 { | |
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
|
737 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
|
738 _focus_check_box(thisbox, handle, 2, 0); |
3 | 739 } |
740 } | |
741 | |
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
|
742 /* 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
|
743 * 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
|
744 */ |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
745 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
|
746 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
747 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
|
748 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
|
749 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
750 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
|
751 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
|
752 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
|
753 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
|
754 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
|
755 |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
756 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
|
757 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
758 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
|
759 _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
|
760 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
761 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
762 |
3 | 763 /* This function will recursively search a box and add up the total height of it */ |
764 void _count_size(HWND box, int type, int *xsize, int *xorigsize) | |
765 { | |
766 int size = 0, origsize = 0, z; | |
767 Box *tmp = WinQueryWindowPtr(box, QWP_USER); | |
768 | |
769 if(!tmp) | |
770 { | |
771 *xsize = *xorigsize = 0; | |
772 return; | |
773 } | |
774 | |
775 if(type == tmp->type) | |
776 { | |
777 /* If the box is going in the direction we want, then we | |
778 * return the entire sum of the items. | |
779 */ | |
780 for(z=0;z<tmp->count;z++) | |
781 { | |
782 if(tmp->items[z].type == TYPEBOX) | |
783 { | |
784 int s, os; | |
785 | |
786 _count_size(tmp->items[z].hwnd, type, &s, &os); | |
787 size += s; | |
788 origsize += os; | |
789 } | |
790 else | |
791 { | |
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
|
792 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
|
793 origsize += (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); |
3 | 794 } |
795 } | |
796 } | |
797 else | |
798 { | |
799 /* If the box is not going in the direction we want, then we only | |
800 * want to return the maximum value. | |
801 */ | |
802 int tmpsize = 0, tmporigsize = 0; | |
803 | |
804 for(z=0;z<tmp->count;z++) | |
805 { | |
806 if(tmp->items[z].type == TYPEBOX) | |
807 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); | |
808 else | |
809 { | |
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
|
810 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
|
811 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); |
3 | 812 } |
813 | |
814 if(tmpsize > size) | |
815 size = tmpsize; | |
816 } | |
817 } | |
818 | |
819 *xsize = size; | |
820 *xorigsize = origsize; | |
821 } | |
822 | |
823 | |
824 /* Function: TrackRectangle | |
825 * Abstract: Tracks given rectangle. | |
826 * | |
827 * If rclBounds is NULL, then track rectangle on entire desktop. | |
828 * rclTrack is in window coorditates and will be mapped to | |
829 * desktop. | |
830 */ | |
831 | |
832 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds) | |
833 { | |
834 TRACKINFO track; | |
835 APIRET rc; | |
836 | |
837 track.cxBorder = 1; | |
838 track.cyBorder = 1; | |
839 track.cxGrid = 1; | |
840 track.cyGrid = 1; | |
841 track.cxKeyboard = 8; | |
842 track.cyKeyboard = 8; | |
843 | |
844 if(!rclTrack) | |
845 return FALSE; | |
846 | |
847 if(rclBounds) | |
848 { | |
849 track.rclBoundary = *rclBounds; | |
850 } | |
851 else | |
852 { | |
853 track.rclBoundary.yTop = | |
854 track.rclBoundary.xRight = 3000; | |
855 track.rclBoundary.yBottom = | |
856 track.rclBoundary.xLeft = -3000; | |
857 } | |
858 | |
859 track.rclTrack = *rclTrack; | |
860 | |
861 WinMapWindowPoints(hwndBase, | |
862 HWND_DESKTOP, | |
863 (PPOINTL)&track.rclTrack, | |
864 2); | |
865 | |
866 track.ptlMinTrackSize.x = track.rclTrack.xRight | |
867 - track.rclTrack.xLeft; | |
868 track.ptlMinTrackSize.y = track.rclTrack.yTop | |
869 - track.rclTrack.yBottom; | |
870 track.ptlMaxTrackSize.x = track.rclTrack.xRight | |
871 - track.rclTrack.xLeft; | |
872 track.ptlMaxTrackSize.y = track.rclTrack.yTop | |
873 - track.rclTrack.yBottom; | |
874 | |
875 track.fs = TF_MOVE | TF_ALLINBOUNDARY; | |
876 | |
877 rc = WinTrackRect(HWND_DESKTOP, 0, &track); | |
878 | |
879 if(rc) | |
880 *rclTrack = track.rclTrack; | |
881 | |
882 return rc; | |
883 } | |
884 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
885 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
|
886 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
887 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
|
888 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
889 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
|
890 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
891 /* 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
|
892 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
|
893 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
894 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
|
895 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
|
896 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
897 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
|
898 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
899 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
|
900 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
|
901 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
902 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
|
903 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
|
904 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
905 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
|
906 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
907 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
|
908 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
|
909 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
|
910 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
|
911 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
912 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
|
913 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
914 _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
|
915 } |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
916 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
|
917 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
918 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
919 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
920 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
921 |
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
|
922 /* 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
|
923 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
|
924 { |
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
|
925 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
|
926 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
|
927 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
|
928 } |
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
|
929 |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
930 BOOL _MySetWindowPos(HWND hwnd, HWND parent, HWND behind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl) |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
931 { |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
932 int height = _get_height(parent); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
933 |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
934 return WinSetWindowPos(hwnd, behind, x, height - y - cy, cx, cy, fl); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
935 } |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
936 |
3 | 937 /* This function calculates how much space the widgets and boxes require |
938 * and does expansion as necessary. | |
939 */ | |
940 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy, | |
941 int pass, int *usedpadx, int *usedpady) | |
942 { | |
943 int z, currentx = 0, currenty = 0; | |
944 int uymax = 0, uxmax = 0; | |
945 int upymax = 0, upxmax = 0; | |
946 /* Used for the SIZEEXPAND */ | |
947 int nux = *usedx, nuy = *usedy; | |
948 int nupx = *usedpadx, nupy = *usedpady; | |
949 | |
950 (*usedx) += (thisbox->pad * 2); | |
951 (*usedy) += (thisbox->pad * 2); | |
952 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
953 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
|
954 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
955 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
|
956 |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
957 thisbox->grouppady = 0; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
958 |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
959 if(text) |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
960 { |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
961 dw_font_text_extents_get(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
|
962 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
|
963 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
964 |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
965 if(thisbox->grouppady) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
966 thisbox->grouppady += 3; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
967 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
968 thisbox->grouppady = 6; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
969 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
970 thisbox->grouppadx = 6; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
971 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
972 (*usedx) += thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
973 (*usedpadx) += thisbox->grouppadx; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
974 (*usedy) += thisbox->grouppady; |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
975 (*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
|
976 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
977 |
3 | 978 for(z=0;z<thisbox->count;z++) |
979 { | |
980 if(thisbox->items[z].type == TYPEBOX) | |
981 { | |
982 int initialx, initialy; | |
983 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
984 | |
985 initialx = x - (*usedx); | |
986 initialy = y - (*usedy); | |
987 | |
988 if(tmp) | |
989 { | |
990 int newx, newy; | |
991 int nux = *usedx, nuy = *usedy; | |
992 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2); | |
993 | |
994 /* On the second pass we know how big the box needs to be and how | |
995 * much space we have, so we can calculate a ratio for the new box. | |
996 */ | |
997 if(pass == 2) | |
998 { | |
999 int deep = *depth + 1; | |
1000 | |
1001 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy); | |
1002 | |
1003 tmp->upx = upx - *usedpadx; | |
1004 tmp->upy = upy - *usedpady; | |
1005 | |
1006 newx = x - nux; | |
1007 newy = y - nuy; | |
1008 | |
1009 tmp->width = thisbox->items[z].width = initialx - newx; | |
1010 tmp->height = thisbox->items[z].height = initialy - newy; | |
1011 | |
1012 tmp->parentxratio = thisbox->xratio; | |
1013 tmp->parentyratio = thisbox->yratio; | |
1014 | |
1015 tmp->parentpad = tmp->pad; | |
1016 | |
1017 /* Just in case */ | |
1018 tmp->xratio = thisbox->xratio; | |
1019 tmp->yratio = thisbox->yratio; | |
1020 | |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1021 if(thisbox->type == DW_VERT) |
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 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
|
1024 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1025 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
|
1026 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
|
1027 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1028 else |
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->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
|
1031 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
|
1032 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1033 if(thisbox->type == DW_HORZ) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1034 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1035 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
|
1036 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1037 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
|
1038 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
|
1039 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1040 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1041 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1042 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
|
1043 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
|
1044 } |
3 | 1045 |
1046 nux = *usedx; nuy = *usedy; | |
1047 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | |
1048 } | |
1049 | |
1050 (*depth)++; | |
1051 | |
1052 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); | |
1053 | |
1054 (*depth)--; | |
1055 | |
1056 newx = x - nux; | |
1057 newy = y - nuy; | |
1058 | |
1059 tmp->minwidth = thisbox->items[z].width = initialx - newx; | |
1060 tmp->minheight = thisbox->items[z].height = initialy - newy; | |
1061 } | |
1062 } | |
1063 | |
1064 if(pass > 1 && *depth > 0) | |
1065 { | |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1066 if(thisbox->type == DW_VERT) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1067 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1068 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
|
1069 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1070 if((thisbox->minwidth-tmppad) == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1071 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
|
1072 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1073 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
|
1074 } |
3 | 1075 else |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1076 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1077 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
|
1078 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
|
1079 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1080 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
|
1081 } |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1082 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1083 if(thisbox->type == DW_HORZ) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1084 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1085 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
|
1086 |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1087 if((thisbox->minheight-tmppad) == 0) |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1088 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
|
1089 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1090 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
|
1091 } |
3 | 1092 else |
457
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1093 { |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1094 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
|
1095 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
|
1096 else |
e6b00c3e5086
Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
454
diff
changeset
|
1097 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
|
1098 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1099 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1100 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
|
1101 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1102 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
|
1103 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1104 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
|
1105 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1106 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
|
1107 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
|
1108 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
1109 } |
3 | 1110 } |
1111 else | |
1112 { | |
1113 thisbox->items[z].xratio = thisbox->xratio; | |
1114 thisbox->items[z].yratio = thisbox->yratio; | |
1115 } | |
1116 | |
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
|
1117 if(thisbox->type == DW_VERT) |
3 | 1118 { |
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
|
1119 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
|
1120 |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1121 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
|
1122 uxmax = itemwidth; |
3 | 1123 if(thisbox->items[z].hsize != SIZEEXPAND) |
1124 { | |
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
|
1125 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
|
1126 upxmax = itemwidth; |
3 | 1127 } |
1128 else | |
1129 { | |
1130 if(thisbox->items[z].pad*2 > upxmax) | |
1131 upxmax = thisbox->items[z].pad*2; | |
1132 } | |
1133 } | |
1134 else | |
1135 { | |
1136 if(thisbox->items[z].width == -1) | |
1137 { | |
1138 /* figure out how much space this item requires */ | |
1139 /* thisbox->items[z].width = */ | |
1140 } | |
1141 else | |
1142 { | |
1143 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
1144 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1145 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
1146 else | |
1147 (*usedpadx) += thisbox->items[z].pad*2; | |
1148 } | |
1149 } | |
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
|
1150 if(thisbox->type == DW_HORZ) |
3 | 1151 { |
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
|
1152 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
|
1153 |
cf00d6e2b3cc
Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
448
diff
changeset
|
1154 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
|
1155 uymax = itemheight; |
3 | 1156 if(thisbox->items[z].vsize != SIZEEXPAND) |
1157 { | |
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
|
1158 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
|
1159 upymax = itemheight; |
3 | 1160 } |
1161 else | |
1162 { | |
1163 if(thisbox->items[z].pad*2 > upymax) | |
1164 upymax = thisbox->items[z].pad*2; | |
1165 } | |
1166 } | |
1167 else | |
1168 { | |
1169 if(thisbox->items[z].height == -1) | |
1170 { | |
1171 /* figure out how much space this item requires */ | |
1172 /* thisbox->items[z].height = */ | |
1173 } | |
1174 else | |
1175 { | |
1176 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
1177 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1178 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
1179 else | |
1180 (*usedpady) += thisbox->items[z].pad*2; | |
1181 } | |
1182 } | |
1183 } | |
1184 | |
1185 (*usedx) += uxmax; | |
1186 (*usedy) += uymax; | |
1187 (*usedpadx) += upxmax; | |
1188 (*usedpady) += upymax; | |
1189 | |
1190 currentx += thisbox->pad; | |
1191 currenty += thisbox->pad; | |
1192 | |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1193 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
|
1194 { |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1195 currentx += 3; |
537
a3b2e2244c18
Code merge with Windows, groupbox text height was being added on the wrong
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
536
diff
changeset
|
1196 currenty += thisbox->grouppady - 3; |
416
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1197 } |
a4197ddfc50d
Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
408
diff
changeset
|
1198 |
3 | 1199 /* The second pass is for expansion and actual placement. */ |
1200 if(pass > 1) | |
1201 { | |
1202 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | |
1203 for(z=0;z<thisbox->count;z++) | |
1204 { | |
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
|
1205 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT) |
3 | 1206 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
|
1207 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) |
3 | 1208 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); |
1209 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | |
1210 if(thisbox->items[z].type == TYPEBOX) | |
1211 { | |
1212 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
1213 | |
1214 if(tmp) | |
1215 { | |
1216 if(*depth > 0) | |
1217 { | |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1218 float calcval; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1219 |
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
|
1220 if(thisbox->type == DW_VERT) |
3 | 1221 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1222 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
|
1223 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1224 tmp->xratio = thisbox->xratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1225 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1226 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1227 tmp->width = thisbox->items[z].width; |
1228 } | |
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
|
1229 if(thisbox->type == DW_HORZ) |
3 | 1230 { |
425
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1231 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
|
1232 if(calcval == 0.0) |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1233 tmp->yratio = thisbox->yratio; |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1234 else |
4fe2df53ec9f
Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
418
diff
changeset
|
1235 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval; |
3 | 1236 tmp->height = thisbox->items[z].height; |
1237 } | |
1238 } | |
1239 | |
1240 (*depth)++; | |
1241 | |
1242 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); | |
1243 | |
1244 (*depth)--; | |
1245 | |
1246 } | |
1247 } | |
1248 } | |
1249 | |
1250 for(z=0;z<(thisbox->count);z++) | |
1251 { | |
1252 int height = thisbox->items[z].height; | |
1253 int width = thisbox->items[z].width; | |
1254 int pad = thisbox->items[z].pad; | |
1255 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
|
1256 int vectorx, vectory; |
3 | 1257 |
1258 /* When upxmax != pad*2 then ratios are incorrect. */ | |
1259 vectorx = (int)((width*thisbox->items[z].xratio)-width); | |
1260 vectory = (int)((height*thisbox->items[z].yratio)-height); | |
1261 | |
1262 if(width > 0 && height > 0) | |
1263 { | |
1264 char tmpbuf[100]; | |
1265 /* This is a hack to fix rounding of the sizing */ | |
1266 if(*depth == 0) | |
1267 { | |
1268 vectorx++; | |
1269 vectory++; | |
1270 } | |
1271 | |
1272 /* If this item isn't going to expand... reset the vectors to 0 */ | |
1273 if(thisbox->items[z].vsize != SIZEEXPAND) | |
1274 vectory = 0; | |
1275 if(thisbox->items[z].hsize != SIZEEXPAND) | |
1276 vectorx = 0; | |
1277 | |
1278 WinQueryClassName(handle, 99, tmpbuf); | |
1279 | |
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
|
1280 if(strncmp(tmpbuf, "#2", 3)==0) |
3 | 1281 { |
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
|
1282 HWND frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); |
3 | 1283 /* 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
|
1284 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
|
1285 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
1286 _MySetWindowPos(frame, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
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
|
1287 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
3 | 1288 } |
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
|
1289 else if(strncmp(tmpbuf, "#6", 3)==0) |
3 | 1290 { |
1291 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */ | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
1292 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3, |
3 | 1293 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1294 } | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1295 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
|
1296 { |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
1297 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1298 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
|
1299 _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
|
1300 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1301 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
|
1302 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1303 /* 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
|
1304 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
|
1305 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
|
1306 int cx = width + vectorx; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1307 int cy = height + vectory; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1308 |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
1309 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1310 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
|
1311 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1312 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
|
1313 _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
|
1314 } |
3 | 1315 else |
1316 { | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
1317 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, |
3 | 1318 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER); |
1319 if(thisbox->items[z].type == TYPEBOX) | |
1320 { | |
1321 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER); | |
1322 | |
1323 if(boxinfo && boxinfo->grouphwnd) | |
1324 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
|
1325 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE); |
3 | 1326 |
1327 } | |
1328 | |
1329 } | |
1330 | |
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
|
1331 if(thisbox->type == DW_HORZ) |
3 | 1332 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
|
1333 if(thisbox->type == DW_VERT) |
3 | 1334 currenty += height + vectory + (pad * 2); |
1335 } | |
1336 } | |
1337 } | |
1338 return 0; | |
1339 } | |
1340 | |
1341 void _do_resize(Box *thisbox, int x, int y) | |
1342 { | |
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
|
1343 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
|
1344 { |
3 | 1345 if(thisbox) |
1346 { | |
1347 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0; | |
1348 | |
1349 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady); | |
1350 | |
1351 if(usedx-usedpadx == 0 || usedy-usedpady == 0) | |
1352 return; | |
1353 | |
1354 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); | |
1355 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); | |
1356 | |
1357 usedx = usedy = usedpadx = usedpady = depth = 0; | |
1358 | |
1359 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); | |
1360 } | |
1361 } | |
1362 } | |
1363 | |
1364 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */ | |
1365 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1366 { | |
1367 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
|
1368 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
|
1369 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
|
1370 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1371 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
|
1372 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
|
1373 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
|
1374 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1375 if(thisbox && !thisbox->titlebar) |
3 | 1376 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1377 switch(msg) |
3 | 1378 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1379 case WM_QUERYTRACKINFO: |
3 | 1380 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1381 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
|
1382 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1383 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
|
1384 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
|
1385 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
|
1386 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
|
1387 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1388 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
|
1389 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1390 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
|
1391 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
|
1392 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1393 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
|
1394 } |
3 | 1395 } |
1396 } | |
1397 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1398 |
3 | 1399 if(blah && *blah) |
1400 { | |
1401 PFNWP myfunc = *blah; | |
1402 return myfunc(hWnd, msg, mp1, mp2); | |
1403 } | |
1404 | |
1405 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1406 } | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1407 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1408 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
|
1409 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1410 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
|
1411 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1412 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
|
1413 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
|
1414 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
|
1415 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
|
1416 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
|
1417 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1418 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1419 /* 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
|
1420 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
|
1421 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1422 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
|
1423 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1424 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
|
1425 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
|
1426 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
|
1427 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
|
1428 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
|
1429 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1430 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1431 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
|
1432 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1433 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
|
1434 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1435 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
|
1436 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
|
1437 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
|
1438 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
|
1439 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
|
1440 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1441 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1442 /* 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
|
1443 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
|
1444 { |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1445 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
|
1446 |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1447 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
|
1448 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
|
1449 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
|
1450 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
|
1451 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
|
1452 } |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
1453 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1454 /* This procedure handles drawing of a status border */ |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1455 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
|
1456 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1457 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1458 |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1459 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1460 return MPFROMSHORT(FALSE); |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
1461 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1462 if(blah && *blah) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1463 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1464 PFNWP myfunc = *blah; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1465 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1466 switch(msg) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1467 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1468 case WM_PAINT: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1469 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1470 HPS hpsPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1471 RECTL rclPaint; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1472 char buf[1024]; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1473 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1474 hpsPaint = WinBeginPaint(hWnd, 0, 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1475 WinQueryWindowRect(hWnd, &rclPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1476 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1477 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1478 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
|
1479 _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
|
1480 _Left(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1481 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1482 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
|
1483 _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
|
1484 _Bottom(hpsPaint, rclPaint); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1485 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1486 WinQueryWindowText(hWnd, 1024, buf); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1487 rclPaint.xLeft += 3; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1488 rclPaint.xRight--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1489 rclPaint.yTop--; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1490 rclPaint.yBottom++; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1491 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1492 GpiSetColor(hpsPaint, CLR_BLACK); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1493 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
|
1494 WinEndPaint(hpsPaint); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1495 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1496 return (MRESULT)TRUE; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1497 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1498 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1499 return myfunc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1500 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1501 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1502 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1503 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
1504 |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1505 /* This procedure handles pointer changes */ |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1506 MRESULT EXPENTRY _textproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1507 { |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1508 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1509 |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1510 if(msg == WM_MOUSEMOVE &&_wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1511 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1512 |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1513 if(blah && *blah) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1514 { |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1515 PFNWP myfunc = *blah; |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1516 |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1517 return myfunc(hWnd, msg, mp1, mp2); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1518 } |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1519 |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1520 return WinDefWindowProc(hWnd, msg, mp1, mp2); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1521 } |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1522 |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1523 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
|
1524 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1525 char tmpbuf[100]; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1526 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1527 WinQueryClassName(handle, 99, tmpbuf); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1528 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1529 /* 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
|
1530 * obtain input focus. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1531 */ |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1532 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
|
1533 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1534 /* 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
|
1535 SignalHandler *tmp = Root; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1536 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1537 /* 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
|
1538 while(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1539 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1540 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
|
1541 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1542 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
|
1543 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1544 /* 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
|
1545 if(tmp->window == handle) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1546 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1547 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
|
1548 tmp = NULL; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1549 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1550 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1551 if(tmp) |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1552 tmp= tmp->next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1553 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1554 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1555 else |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1556 WinSetFocus(HWND_DESKTOP, handle); |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1557 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1558 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1559 #define ENTRY_CUT 1001 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1560 #define ENTRY_COPY 1002 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1561 #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
|
1562 #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
|
1563 #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
|
1564 |
3 | 1565 /* Originally just intended for entryfields, it now serves as a generic |
1566 * procedure for handling TAB presses to change input focus on controls. | |
1567 */ | |
1568 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1569 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1570 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
|
1571 PFNWP oldproc = 0; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1572 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
|
1573 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1574 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1575 oldproc = blah->oldproc; |
3 | 1576 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1577 WinQueryClassName(hWnd, 99, tmpbuf); |
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 /* 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
|
1580 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
|
1581 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
|
1582 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
|
1583 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
|
1584 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1585 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1586 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1587 case WM_CONTEXTMENU: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1588 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1589 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
|
1590 long x, y; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1591 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1592 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
|
1593 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1594 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
|
1595 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
|
1596 } |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1597 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
|
1598 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
|
1599 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1600 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
|
1601 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
|
1602 } |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1603 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
|
1604 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
|
1605 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1606 WinSetFocus(HWND_DESKTOP, hWnd); |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1607 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
|
1608 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
|
1609 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1610 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1611 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1612 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1613 ULONG command = COMMANDMSG(&msg)->cmd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1614 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1615 /* MLE */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1616 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
|
1617 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1618 switch(command) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1619 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1620 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1621 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
|
1622 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1623 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
|
1624 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1625 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
|
1626 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
|
1627 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
|
1628 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
|
1629 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1630 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
|
1631 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
|
1632 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1633 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1634 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1635 else /* Other */ |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1636 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1637 HWND handle = hWnd; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1638 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1639 /* 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
|
1640 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
|
1641 handle = WinWindowFromID(hWnd, 667); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1642 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1643 if(handle) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1644 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1645 switch(command) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1646 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1647 case ENTRY_CUT: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1648 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
|
1649 case ENTRY_COPY: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1650 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
|
1651 case ENTRY_PASTE: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1652 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
|
1653 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
|
1654 { |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1655 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
|
1656 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
|
1657 } |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1658 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1659 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1660 } |
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 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1663 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1664 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1665 |
3 | 1666 switch(msg) |
1667 { | |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1668 case WM_BUTTON1DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1669 case WM_BUTTON2DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1670 case WM_BUTTON3DOWN: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1671 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1672 if(strncmp(tmpbuf, "#32", 4)==0) |
38
538db2a48bac
Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
37
diff
changeset
|
1673 _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
|
1674 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1675 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
|
1676 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
|
1677 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1678 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
|
1679 _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
|
1680 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
1681 break; |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1682 case WM_SETFOCUS: |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1683 _run_event(hWnd, msg, mp1, mp2); |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
1684 break; |
3 | 1685 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1686 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
|
1687 return (MRESULT)TRUE; |
3 | 1688 if(SHORT1FROMMP(mp2) == '\t') |
1689 { | |
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
|
1690 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
|
1691 _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
|
1692 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
|
1693 _shift_focus(hWnd); |
3 | 1694 return FALSE; |
1695 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1696 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
|
1697 _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
|
1698 /* 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
|
1699 * 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
|
1700 */ |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1701 else if(SHORT1FROMMP(mp2) == 283) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
1702 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
|
1703 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1704 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1705 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
|
1706 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1707 /* 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
|
1708 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
|
1709 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
|
1710 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1711 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1712 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
|
1713 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1714 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
|
1715 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
|
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 break; |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
1718 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1719 if(_wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1720 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1721 break; |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1722 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1723 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1724 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
|
1725 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
|
1726 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1727 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
|
1728 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1729 |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1730 /* 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
|
1731 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
|
1732 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1733 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
|
1734 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1735 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1736 { |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
1737 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1738 if(_wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1739 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1740 break; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1741 case WM_CONTEXTMENU: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1742 case WM_COMMAND: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1743 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
|
1744 case WM_SETFOCUS: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1745 _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
|
1746 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1747 case WM_CHAR: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1748 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
|
1749 return (MRESULT)TRUE; |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1750 /* 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
|
1751 if(SHORT1FROMMP(mp2) == 283) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1752 return (MRESULT)TRUE; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1753 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1754 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1755 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1756 if(blah && blah->oldproc) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1757 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
|
1758 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1759 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
|
1760 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1761 |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1762 /* 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
|
1763 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
|
1764 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1765 switch(msg) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1766 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1767 case WM_VSCROLL: |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1768 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK) |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1769 { |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1770 USHORT pos = SHORT1FROMMP(mp2); |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1771 |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
1772 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
|
1773 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1774 break; |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1775 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1776 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
|
1777 } |
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
1778 |
156 | 1779 /* Handle special messages for the spinbutton's entryfield */ |
1780 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1781 { | |
1782 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | |
1783 PFNWP oldproc = 0; | |
1784 | |
1785 if(blah) | |
1786 oldproc = blah->oldproc; | |
1787 | |
1788 switch(msg) | |
1789 { | |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
1790 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1791 if(_wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1792 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1793 break; |
156 | 1794 case WM_CONTEXTMENU: |
1795 case WM_COMMAND: | |
1796 return _entryproc(hWnd, msg, mp1, mp2); | |
1797 } | |
1798 | |
1799 if(oldproc) | |
1800 return oldproc(hWnd, msg, mp1, mp2); | |
1801 | |
1802 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1803 } | |
1804 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1805 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
|
1806 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1807 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value"); |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
1808 int range = dw_percent_get_range(hwnd); |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1809 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
|
1810 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
|
1811 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
|
1812 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
|
1813 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1814 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1815 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
|
1816 { |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
1817 int inew, range = dw_percent_get_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
|
1818 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
|
1819 { |
bb039d7407f0
Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
108
diff
changeset
|
1820 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
|
1821 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
|
1822 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
|
1823 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
|
1824 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
|
1825 } |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1826 } |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1827 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1828 /* 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
|
1829 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
|
1830 { |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1831 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
|
1832 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
|
1833 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1834 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
|
1835 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
|
1836 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1837 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
|
1838 { |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
1839 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1840 if(_wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1841 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1842 break; |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1843 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
|
1844 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
|
1845 break; |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
1846 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
|
1847 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd)); |
3 | 1848 break; |
1849 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1850 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1851 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1852 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1853 |
1854 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1855 } | |
1856 | |
1857 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN | |
1858 * flag enabled, and also handle TABs to switch input focus. | |
1859 */ | |
1860 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
1861 { | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1862 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
|
1863 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
|
1864 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1865 if(blah) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1866 oldproc = blah->oldproc; |
3 | 1867 |
1868 switch(msg) | |
1869 { | |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
1870 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1871 if(_wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1872 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
1873 break; |
3 | 1874 case WM_CHAR: |
1875 if(SHORT1FROMMP(mp2) == '\t') | |
1876 { | |
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
|
1877 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
|
1878 _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
|
1879 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
|
1880 _shift_focus(hWnd); |
3 | 1881 return FALSE; |
1882 } | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
1883 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
|
1884 _click_default(blah->clickdefault); |
3 | 1885 break; |
160
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1886 case WM_BUTTON1DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1887 case WM_BUTTON2DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1888 case WM_BUTTON3DBLCLK: |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1889 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
|
1890 return (MRESULT)TRUE; |
76bc6b4e8b79
Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
159
diff
changeset
|
1891 break; |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1892 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
|
1893 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
|
1894 case WM_BUTTON3DOWN: |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
1895 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
|
1896 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
|
1897 _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
|
1898 break; |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
1899 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
|
1900 _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
|
1901 break; |
3 | 1902 case WM_PAINT: |
1903 { | |
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
|
1904 HWND entry, frame = (HWND)dw_window_get_data(hWnd, "_dw_combo_box"), parent = WinQueryWindow(frame, QW_PARENT); |
3 | 1905 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
|
1906 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
|
1907 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
|
1908 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
|
1909 |
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
|
1910 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
|
1911 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
|
1912 |
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
|
1913 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
|
1914 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
|
1915 |
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
|
1916 /* 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
|
1917 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
|
1918 |
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
|
1919 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
|
1920 dw_window_get_pos_size(hWnd, 0, 0, &width, &height); |
3 | 1921 |
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
|
1922 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
|
1923 { |
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
|
1924 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
|
1925 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
|
1926 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
|
1927 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
|
1928 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
|
1929 |
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
|
1930 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
|
1931 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
|
1932 |
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
|
1933 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
|
1934 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
|
1935 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
|
1936 |
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
|
1937 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
|
1938 } |
3 | 1939 } |
1940 break; | |
1941 } | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1942 if(oldproc) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
1943 return oldproc(hWnd, msg, mp1, mp2); |
3 | 1944 |
1945 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
1946 } | |
1947 | |
1948 void _GetPPFont(HWND hwnd, char *buff) | |
1949 { | |
1950 ULONG AttrFound; | |
1951 BYTE AttrValue[128]; | |
1952 ULONG cbRetLen; | |
1953 | |
1954 cbRetLen = WinQueryPresParam(hwnd, | |
1955 PP_FONTNAMESIZE, | |
1956 0, | |
1957 &AttrFound, | |
1958 sizeof(AttrValue), | |
1959 &AttrValue, | |
1960 QPF_NOINHERIT); | |
1961 | |
1962 if(PP_FONTNAMESIZE == AttrFound && cbRetLen) | |
1963 { | |
1964 memcpy(buff, AttrValue, cbRetLen); | |
1965 } | |
1966 } | |
1967 | |
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
|
1968 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
|
1969 { |
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
|
1970 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
|
1971 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
|
1972 |
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
|
1973 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
|
1974 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
|
1975 |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
1976 pos = dw_scrollbar_get_pos(handle); |
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
|
1977 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
|
1978 |
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
|
1979 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
|
1980 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
|
1981 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
|
1982 |
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
|
1983 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
|
1984 { |
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
|
1985 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
|
1986 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
|
1987 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
|
1988 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
|
1989 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
|
1990 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
|
1991 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
|
1992 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
|
1993 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
|
1994 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
|
1995 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
|
1996 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
|
1997 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
|
1998 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
|
1999 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
|
2000 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
|
2001 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
|
2002 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
|
2003 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
|
2004 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
|
2005 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
|
2006 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
|
2007 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
|
2008 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
|
2009 } |
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
|
2010 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
|
2011 } |
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
|
2012 |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2013 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
|
2014 { |
315
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
2015 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
|
2016 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
|
2017 hwndEmph = NULLHANDLE; |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2018 pCoreEmph = NULL; |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2019 } |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2020 |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2021 /* Find the desktop window handle */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2022 HWND _menu_owner(HWND handle) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2023 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2024 HWND menuowner = NULLHANDLE, lastowner = (HWND)dw_window_get_data(handle, "_dw_owner"); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2025 int menubar = (int)dw_window_get_data(handle, "_dw_menubar"); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2026 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2027 /* Find the toplevel window */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2028 while(!menubar && (menuowner = (HWND)dw_window_get_data(lastowner, "_dw_owner")) != NULLHANDLE) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2029 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2030 menubar = (int)dw_window_get_data(lastowner, "_dw_menubar"); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2031 lastowner = menuowner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2032 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2033 if(menuowner && menubar) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2034 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2035 HWND client = WinWindowFromID(menuowner, FID_CLIENT); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2036 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2037 return client ? client : menuowner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2038 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2039 return NULLHANDLE; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2040 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2041 |
3 | 2042 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2043 { | |
2044 int result = -1; | |
2045 SignalHandler *tmp = Root; | |
2046 ULONG origmsg = msg; | |
2047 | |
2048 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) | |
2049 msg = WM_BUTTON1DOWN; | |
2050 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) | |
2051 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
|
2052 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
|
2053 msg = WM_CONTROL; |
3 | 2054 |
2055 /* Find any callbacks for this function */ | |
2056 while(tmp) | |
2057 { | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2058 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1) |
3 | 2059 { |
2060 switch(msg) | |
2061 { | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2062 case WM_SETFOCUS: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2063 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2064 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
|
2065 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2066 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
|
2067 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2068 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
|
2069 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2070 result = setfocusfunc(tmp->window, tmp->data); |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2071 tmp = NULL; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2072 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2073 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2074 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
2075 break; |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2076 case WM_TIMER: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2077 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2078 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
|
2079 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
|
2080 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2081 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
|
2082 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
|
2083 tmp = NULL; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2084 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2085 result = 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2086 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
2087 break; |
3 | 2088 case WM_SIZE: |
2089 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2090 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction; |
3 | 2091 |
276
dfbda83b7cad
Eliminate configure event callbacks when either the width or height is 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
267
diff
changeset
|
2092 if((hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) && SHORT1FROMMP(mp2) && SHORT2FROMMP(mp2)) |
3 | 2093 { |
2094 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data); | |
2095 tmp = NULL; | |
2096 } | |
2097 } | |
2098 break; | |
2099 case WM_BUTTON1DOWN: | |
2100 { | |
2101 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2102 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2103 |
2104 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2105 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2106 int button = 0; |
3 | 2107 |
2108 switch(origmsg) | |
2109 { | |
2110 case WM_BUTTON1DOWN: | |
2111 button = 1; | |
2112 break; | |
2113 case WM_BUTTON2DOWN: | |
2114 button = 2; | |
2115 break; | |
2116 case WM_BUTTON3DOWN: | |
2117 button = 3; | |
2118 break; | |
2119 } | |
2120 | |
2121 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data); | |
2122 tmp = NULL; | |
2123 } | |
2124 } | |
2125 break; | |
2126 case WM_BUTTON1UP: | |
2127 { | |
2128 POINTS pts = (*((POINTS*)&mp1)); | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2129 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2130 |
2131 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2132 { | |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
23
diff
changeset
|
2133 int button = 0; |
3 | 2134 |
2135 switch(origmsg) | |
2136 { | |
2137 case WM_BUTTON1UP: | |
2138 button = 1; | |
2139 break; | |
2140 case WM_BUTTON2UP: | |
2141 button = 2; | |
2142 break; | |
2143 case WM_BUTTON3UP: | |
2144 button = 3; | |
2145 break; | |
2146 } | |
2147 | |
2148 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); | |
2149 tmp = NULL; | |
2150 } | |
2151 } | |
2152 break; | |
2153 case WM_MOUSEMOVE: | |
2154 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2155 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction; |
3 | 2156 |
2157 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window) | |
2158 { | |
2159 int keys = 0; | |
2160 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1); | |
2161 | |
2162 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000) | |
2163 keys = DW_BUTTON1_MASK; | |
2164 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) | |
2165 keys |= DW_BUTTON2_MASK; | |
2166 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000) | |
2167 keys |= DW_BUTTON3_MASK; | |
2168 | |
2169 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data); | |
2170 tmp = NULL; | |
2171 } | |
2172 } | |
2173 break; | |
2174 case WM_CHAR: | |
2175 { | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2176 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
|
2177 |
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
|
2178 if((hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP)) |
3 | 2179 { |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2180 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
|
2181 char ch = 0; |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2182 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2183 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
|
2184 ch = (char)SHORT1FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2185 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
|
2186 vk = SHORT2FROMMP(mp2); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2187 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
|
2188 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
|
2189 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2190 /* 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
|
2191 * up as tabs! |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2192 */ |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2193 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
|
2194 { |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2195 ch = 0; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2196 vk = VK_SHIFT; |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2197 } |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2198 |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
2199 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
|
2200 SHORT1FROMMP(mp1) & (KC_ALT | KC_SHIFT | KC_CTRL), tmp->data); |
3 | 2201 tmp = NULL; |
2202 } | |
2203 } | |
2204 break; | |
2205 case WM_CLOSE: | |
2206 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2207 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2208 |
2209 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT)) | |
2210 { | |
2211 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
|
2212 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
|
2213 result = FALSE; |
3 | 2214 tmp = NULL; |
2215 } | |
2216 } | |
2217 break; | |
2218 case WM_PAINT: | |
2219 { | |
2220 HPS hps; | |
2221 DWExpose exp; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2222 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction; |
3 | 2223 RECTL rc; |
2224 | |
2225 if(hWnd == tmp->window) | |
2226 { | |
2227 int height = _get_height(hWnd); | |
2228 | |
2229 hps = WinBeginPaint(hWnd, 0L, &rc); | |
2230 exp.x = rc.xLeft; | |
2231 exp.y = height - rc.yTop - 1; | |
2232 exp.width = rc.xRight - rc. xLeft; | |
2233 exp.height = rc.yTop - rc.yBottom; | |
2234 result = exposefunc(hWnd, &exp, tmp->data); | |
2235 WinEndPaint(hps); | |
2236 } | |
2237 } | |
2238 break; | |
2239 case WM_COMMAND: | |
2240 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2241 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 2242 ULONG command = COMMANDMSG(&msg)->cmd; |
2243 | |
466
c3dfa117b080
Added new code to make the menu handlers window local instead of global.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
465
diff
changeset
|
2244 if(tmp->id && command == tmp->id) |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2245 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2246 HWND menuowner = _menu_owner(tmp->window); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2247 |
466
c3dfa117b080
Added new code to make the menu handlers window local instead of global.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
465
diff
changeset
|
2248 if(menuowner == hWnd || menuowner == NULLHANDLE) |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2249 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2250 result = clickfunc(tmp->window, tmp->data); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2251 tmp = NULL; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2252 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2253 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
2254 else if(tmp->window < 65536 && command == tmp->window) |
3 | 2255 { |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
2256 result = clickfunc(popup ? popup : tmp->window, tmp->data); |
3 | 2257 tmp = NULL; |
2258 } | |
2259 } | |
2260 break; | |
2261 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
|
2262 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
|
2263 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE)) |
3 | 2264 { |
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
|
2265 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
|
2266 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
|
2267 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
|
2268 |
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
|
2269 switch(svar) |
3 | 2270 { |
2271 case CN_ENTER: | |
2272 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2273 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction; |
3 | 2274 int id = SHORT1FROMMP(mp1); |
2275 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2276 char *text = NULL; | |
2277 | |
2278 if(mp2) | |
2279 { | |
2280 PRECORDCORE pre; | |
2281 | |
2282 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; | |
2283 if(pre) | |
2284 text = pre->pszIcon; | |
2285 } | |
2286 | |
2287 if(tmp->window == conthwnd) | |
2288 { | |
2289 result = containerselectfunc(tmp->window, text, tmp->data); | |
2290 tmp = NULL; | |
2291 } | |
2292 } | |
2293 break; | |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2294 case CN_EXPANDTREE: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2295 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2296 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))tmp->signalfunction; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2297 int id = SHORT1FROMMP(mp1); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2298 HWND conthwnd = dw_window_from_id(hWnd, id); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2299 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2300 if(tmp->window == conthwnd) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2301 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2302 result = treeexpandfunc(tmp->window, (HTREEITEM)mp2, tmp->data); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2303 tmp = NULL; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2304 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2305 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
2306 break; |
3 | 2307 case CN_CONTEXTMENU: |
2308 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2309 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction; |
3 | 2310 int id = SHORT1FROMMP(mp1); |
2311 HWND conthwnd = dw_window_from_id(hWnd, id); | |
2312 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
|
2313 void *user = NULL; |
3 | 2314 LONG x,y; |
2315 | |
2316 if(mp2) | |
2317 { | |
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
|
2318 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
|
2319 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2320 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
|
2321 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2322 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
|
2323 user = pci->user; |
3 | 2324 } |
2325 | |
2326 dw_pointer_query_pos(&x, &y); | |
2327 | |
2328 if(tmp->window == conthwnd) | |
2329 { | |
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
|
2330 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
|
2331 |
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
|
2332 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
|
2333 { |
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
|
2334 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
|
2335 { |
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
|
2336 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
|
2337 |
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
|
2338 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
|
2339 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
|
2340 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
|
2341 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
|
2342 _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
|
2343 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
|
2344 } |
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
|
2345 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
|
2346 { |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2347 if(pCoreEmph) |
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2348 _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
|
2349 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
|
2350 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
|
2351 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
|
2352 } |
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
|
2353 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2354 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); |
3 | 2355 tmp = NULL; |
2356 } | |
2357 } | |
2358 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
|
2359 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
|
2360 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2361 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
|
2362 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
|
2363 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2364 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
|
2365 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2366 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
|
2367 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2368 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
|
2369 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2370 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
|
2371 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2372 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
|
2373 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2374 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
|
2375 { |
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
|
2376 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
|
2377 |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2378 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
|
2379 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
|
2380 else |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2381 { |
161
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2382 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
|
2383 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2384 lasthcnr = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2385 lastitem = 0; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2386 } |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2387 else |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2388 { |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2389 lasthcnr = tmp->window; |
c555d06b6c93
Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
160
diff
changeset
|
2390 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
|
2391 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
|
2392 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
2393 } |
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
|
2394 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
|
2395 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2396 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2397 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2398 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
|
2399 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2400 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
2401 break; |
3 | 2402 case LN_SELECT: |
2403 { | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2404 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
|
2405 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2406 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
|
2407 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2408 if(strncmp(classbuf, "#38", 4) == 0) |
3 | 2409 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2410 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
|
2411 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2412 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
|
2413 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2414 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
|
2415 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
|
2416 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
|
2417 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
|
2418 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2419 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
|
2420 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
|
2421 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
|
2422 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2423 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
|
2424 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2425 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2426 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2427 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2428 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
|
2429 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
|
2430 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
|
2431 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
|
2432 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2433 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) |
3 | 2434 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2435 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
|
2436 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
|
2437 |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
2438 dw_listbox_get_text(tmp->window, index, buf1, 500); |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2439 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2440 _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
|
2441 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2442 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
|
2443 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2444 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
|
2445 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2446 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
|
2447 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2448 /* 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
|
2449 * 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
|
2450 */ |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2451 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
|
2452 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
|
2453 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2454 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
|
2455 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
|
2456 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2457 else |
3 | 2458 result = listboxselectfunc(tmp->window, index, tmp->data); |
2459 | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2460 _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
|
2461 tmp = NULL; |
3 | 2462 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2463 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2464 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2465 break; |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2466 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
|
2467 { |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
2468 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
|
2469 |
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
|
2470 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
|
2471 { |
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
|
2472 /* 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
|
2473 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
|
2474 { |
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
|
2475 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
|
2476 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
|
2477 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
|
2478 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
|
2479 { |
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
|
2480 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
|
2481 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
|
2482 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
|
2483 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
|
2484 } |
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
|
2485 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
|
2486 } |
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
|
2487 } |
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
|
2488 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
|
2489 { |
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
|
2490 /* 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
|
2491 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
|
2492 { |
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
|
2493 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
|
2494 |
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
|
2495 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
|
2496 { |
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
|
2497 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
|
2498 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
|
2499 } |
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
|
2500 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
|
2501 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
|
2502 } |
3 | 2503 } |
2504 } | |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2505 break; |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2506 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
|
2507 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2508 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
|
2509 |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2510 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
|
2511 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2512 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
|
2513 |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2514 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
|
2515 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
|
2516 } |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
2517 } |
3 | 2518 break; |
2519 } | |
2520 } | |
2521 break; | |
2522 } | |
2523 } | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
2524 |
3 | 2525 if(tmp) |
2526 tmp = tmp->next; | |
2527 | |
2528 } | |
2529 return (MRESULT)result; | |
2530 } | |
2531 | |
2532 /* Handles control messages sent to the box (owner). */ | |
2533 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2534 { | |
2535 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER); | |
2536 | |
2537 switch(msg) | |
2538 { | |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2539 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
2540 if(_wndproc(hWnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
2541 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
2542 break; |
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
|
2543 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
|
2544 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
|
2545 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
|
2546 { |
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
|
2547 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
|
2548 _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
|
2549 } |
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
|
2550 break; |
3 | 2551 case WM_CONTROL: |
2552 _run_event(hWnd, msg, mp1, mp2); | |
2553 break; | |
2554 } | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2555 |
3 | 2556 if(blah && blah->oldproc) |
2557 return blah->oldproc(hWnd, msg, mp1, mp2); | |
2558 | |
2559 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2560 } | |
2561 | |
2562 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ | |
2563 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2564 { | |
2565 int result = -1; | |
2566 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
|
2567 void (* API windowfunc)(PVOID) = 0L; |
3 | 2568 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
2569 if(!command_active) |
3 | 2570 { |
2571 /* Make sure we don't end up in infinite recursion */ | |
2572 command_active = 1; | |
2573 | |
2574 result = (int)_run_event(hWnd, msg, mp1, mp2); | |
2575 | |
2576 command_active = 0; | |
2577 } | |
2578 | |
2579 /* Now that any handlers are done... do normal processing */ | |
2580 switch( msg ) | |
2581 { | |
2582 case WM_ERASEBACKGROUND: | |
2583 return 0; | |
2584 | |
2585 case WM_PAINT: | |
2586 { | |
2587 HPS hps; | |
2588 RECTL rc; | |
2589 | |
2590 hps = WinBeginPaint( hWnd, 0L, &rc ); | |
2591 WinEndPaint( hps ); | |
2592 break; | |
2593 } | |
2594 | |
2595 case WM_SIZE: | |
2596 { | |
2597 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2598 | |
2599 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2)) | |
2600 return (MPARAM)TRUE; | |
2601 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2602 if(mybox && mybox->flags != DW_MINIMIZED) |
3 | 2603 { |
2604 /* Hide the window when recalculating to reduce | |
2605 * CPU load. | |
2606 */ | |
2607 WinShowWindow(hWnd, FALSE); | |
2608 | |
536
81e29ea5dc2f
Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
535
diff
changeset
|
2609 if(mybox->items) |
81e29ea5dc2f
Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
535
diff
changeset
|
2610 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE); |
81e29ea5dc2f
Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
535
diff
changeset
|
2611 |
3 | 2612 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); |
2613 | |
2614 WinShowWindow(hWnd, TRUE); | |
2615 } | |
2616 } | |
2617 break; | |
2618 case WM_MINMAXFRAME: | |
2619 { | |
2620 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER); | |
2621 SWP *swp = (SWP *)mp1; | |
2622 | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2623 if(mybox && (swp->fl & SWP_MINIMIZE)) |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2624 mybox->flags = DW_MINIMIZED; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2625 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2626 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
|
2627 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
2628 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
|
2629 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2630 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
|
2631 } |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2632 |
536
81e29ea5dc2f
Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
535
diff
changeset
|
2633 if(mybox && (swp->fl & (SWP_MAXIMIZE | SWP_RESTORE))) |
3 | 2634 { |
2635 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
|
2636 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
|
2637 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2638 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
|
2639 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
2640 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
|
2641 return FALSE; |
3 | 2642 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2643 mybox->flags = 0; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
2644 |
3 | 2645 /* Hide the window when recalculating to reduce |
2646 * CPU load. | |
2647 */ | |
2648 WinShowWindow(hWnd, FALSE); | |
2649 | |
2650 _do_resize(mybox, swp->cx, swp->cy); | |
2651 | |
2652 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX) | |
2653 { | |
2654 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER); | |
2655 | |
2656 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
|
2657 _check_resize_notebook(mybox->items[z].hwnd); |
3 | 2658 |
2659 } | |
2660 | |
2661 WinShowWindow(hWnd, TRUE); | |
2662 } | |
2663 } | |
2664 break; | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2665 case WM_CONTROL: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2666 switch(SHORT2FROMMP(mp1)) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2667 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2668 case BKN_PAGESELECTEDPENDING: |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2669 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2670 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2671 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
|
2672 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
|
2673 unsigned long x, y, width, height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2674 RECTL rc; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2675 |
21
c6e76b796b28
Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
20
diff
changeset
|
2676 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
|
2677 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2678 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
|
2679 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2680 rc.xLeft = x; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2681 rc.yBottom = y; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2682 rc.xRight = x + width; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2683 rc.yTop = y + height; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2684 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2685 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
|
2686 |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2687 _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
|
2688 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2689 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2690 break; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2691 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
2692 break; |
3 | 2693 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
|
2694 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
|
2695 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2696 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
|
2697 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
|
2698 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2699 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
|
2700 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
|
2701 { |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2702 HPOINTER pointer; |
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2703 |
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2704 if((pointer = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer")) || |
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2705 (pointer = (HPOINTER)dw_window_get_data(_toplevel_window(hWnd), "_dw_pointer"))) |
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2706 { |
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2707 WinSetPointer(HWND_DESKTOP, pointer); |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
2708 return MRFROMSHORT(TRUE); |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2709 } |
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2710 } |
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
2711 return MRFROMSHORT(FALSE); |
3 | 2712 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
|
2713 windowfunc = (void (* API)(void *))mp1; |
3 | 2714 |
2715 if(windowfunc) | |
2716 windowfunc((void *)mp2); | |
2717 break; | |
2718 case WM_CHAR: | |
2719 if(SHORT1FROMMP(mp2) == '\t') | |
2720 { | |
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
|
2721 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
|
2722 _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
|
2723 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
|
2724 _shift_focus(hWnd); |
3 | 2725 return FALSE; |
2726 } | |
2727 break; | |
2728 case WM_DESTROY: | |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2729 { |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2730 HWND parent = WinQueryWindow(hWnd, QW_PARENT); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2731 |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2732 /* Free memory before destroying */ |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2733 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2734 _free_window_memory(parent); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2735 else |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2736 _free_window_memory(hWnd); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
2737 } |
3 | 2738 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
|
2739 case WM_MENUEND: |
498
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2740 /* Delay removing the signal until we've executed |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2741 * the signal handler. |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2742 */ |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2743 WinPostMsg(hWnd, WM_USER+2, mp1, mp2); |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2744 break; |
00d0514cadc8
Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
497
diff
changeset
|
2745 case WM_USER+2: |
314
41b890c649e7
Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
311
diff
changeset
|
2746 _clear_emphasis(); |
499
b658d9628f41
Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
498
diff
changeset
|
2747 if(dw_window_get_data((HWND)mp2, "_dw_popup")) |
b658d9628f41
Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
498
diff
changeset
|
2748 _free_menu_data((HWND)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
|
2749 break; |
3 | 2750 } |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
2751 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
2752 if(result != -1) |
3 | 2753 return (MRESULT)result; |
2754 else | |
2755 return WinDefWindowProc(hWnd, msg, mp1, mp2); | |
2756 } | |
2757 | |
2758 void _changebox(Box *thisbox, int percent, int type) | |
2759 { | |
2760 int z; | |
2761 | |
2762 for(z=0;z<thisbox->count;z++) | |
2763 { | |
2764 if(thisbox->items[z].type == TYPEBOX) | |
2765 { | |
2766 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | |
2767 _changebox(tmp, percent, type); | |
2768 } | |
2769 else | |
2770 { | |
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
|
2771 if(type == DW_HORZ) |
3 | 2772 { |
2773 if(thisbox->items[z].hsize == SIZEEXPAND) | |
2774 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | |
2775 } | |
2776 else | |
2777 { | |
2778 if(thisbox->items[z].vsize == SIZEEXPAND) | |
2779 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0))); | |
2780 } | |
2781 } | |
2782 } | |
2783 } | |
2784 | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2785 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
|
2786 { |
539
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2787 float ratio = (float)percent/(float)100.0; |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2788 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2789 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2790 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2791 |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2792 WinShowWindow(handle1, FALSE); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2793 WinShowWindow(handle2, FALSE); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2794 |
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
|
2795 if(type == DW_HORZ) |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2796 { |
539
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2797 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2798 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2799 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
|
2800 _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
|
2801 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2802 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
|
2803 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2804 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2805 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2806 newx = x - newx - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2807 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2808 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
|
2809 _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
|
2810 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2811 else |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2812 { |
539
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2813 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2814 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2815 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
|
2816 _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
|
2817 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2818 tmp = WinQueryWindowPtr(handle2, QWP_USER); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2819 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2820 newy = y - newy - SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2821 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2822 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
|
2823 _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
|
2824 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2825 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
|
2826 } |
539
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2827 |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2828 WinShowWindow(handle1, TRUE); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2829 WinShowWindow(handle2, TRUE); |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2830 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2831 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2832 |
3 | 2833 /* This handles any activity on the splitbars (sizers) */ |
2834 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2835 { | |
2836 switch (msg) | |
2837 { | |
2838 case WM_ACTIVATE: | |
2839 case WM_SETFOCUS: | |
2840 return (MRESULT)(FALSE); | |
2841 | |
2842 case WM_PAINT: | |
2843 { | |
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
|
2844 HPS hps; |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2845 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
|
2846 RECTL rcl; |
539
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2847 int type = (int)dw_window_get_data(hwnd, "_dw_type"); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2848 int start = (int)dw_window_get_data(hwnd, "_dw_start"); |
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
|
2849 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2850 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
|
2851 |
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
|
2852 WinQueryWindowRect(hwnd, &rcl); |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2853 |
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
|
2854 if(type == DW_HORZ) |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2855 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2856 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
|
2857 ptl[0].y = rcl.yBottom; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2858 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
|
2859 ptl[1].y = rcl.yTop; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2860 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2861 else |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2862 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2863 ptl[0].x = rcl.xLeft; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2864 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
|
2865 ptl[1].x = rcl.xRight; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2866 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
|
2867 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
2868 |
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
|
2869 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
2870 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
|
2871 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
|
2872 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
|
2873 WinEndPaint(hps); |
3 | 2874 } |
2875 return MRFROMSHORT(FALSE); | |
2876 | |
2877 case WM_MOUSEMOVE: | |
2878 { | |
539
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2879 int type = (int)dw_window_get_data(hwnd, "_dw_type"); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2880 |
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
|
2881 if(type == DW_HORZ) |
3 | 2882 WinSetPointer(HWND_DESKTOP, |
2883 WinQuerySysPointer(HWND_DESKTOP, | |
2884 SPTR_SIZEWE, | |
2885 FALSE)); | |
2886 else | |
2887 WinSetPointer(HWND_DESKTOP, | |
2888 WinQuerySysPointer(HWND_DESKTOP, | |
2889 SPTR_SIZENS, | |
2890 FALSE)); | |
2891 } | |
2892 return MRFROMSHORT(FALSE); | |
2893 case WM_BUTTON1DOWN: | |
2894 { | |
2895 APIRET rc; | |
2896 RECTL rclFrame; | |
2897 RECTL rclBounds; | |
539
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2898 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent"); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2899 int type = (int)dw_window_get_data(hwnd, "_dw_type"); |
8f80ed604a89
Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
538
diff
changeset
|
2900 int start = (int)dw_window_get_data(hwnd, "_dw_start"); |
3 | 2901 |
2902 WinQueryWindowRect(hwnd, &rclFrame); | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2903 WinQueryWindowRect(hwnd, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2904 |
3 | 2905 WinMapWindowPoints(hwnd, HWND_DESKTOP, |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2906 (PPOINTL)&rclBounds, 2); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2907 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2908 |
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
|
2909 if(type == DW_HORZ) |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2910 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2911 rclFrame.xLeft = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2912 rclFrame.xRight = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2913 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2914 else |
3 | 2915 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2916 rclFrame.yBottom = start; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2917 rclFrame.yTop = start + SPLITBAR_WIDTH; |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2918 } |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2919 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2920 if(percent) |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2921 { |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2922 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2923 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2924 if(rc == TRUE) |
3 | 2925 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2926 int width = (rclBounds.xRight - rclBounds.xLeft); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2927 int height = (rclBounds.yTop - rclBounds.yBottom); |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2928 |
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
|
2929 if(type == DW_HORZ) |
3 | 2930 { |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2931 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
|
2932 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
|
2933 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; |
3 | 2934 } |
2935 else | |
2936 { | |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2937 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
|
2938 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
|
2939 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0); |
3 | 2940 } |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
2941 _handle_splitbar_resize(hwnd, *percent, type, width, height); |
541
f65fc3a049ff
Move the fix, but it is just as ugly as before. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
540
diff
changeset
|
2942 _handle_splitbar_resize(hwnd, *percent, type, width, height); |
3 | 2943 } |
2944 } | |
2945 } | |
2946 return MRFROMSHORT(FALSE); | |
2947 } | |
2948 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2949 } | |
2950 | |
2951 /* Function: BubbleProc | |
2952 * Abstract: Subclass procedure for bubble help | |
2953 */ | |
2954 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
2955 { | |
2956 MRESULT res; | |
2957 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER); | |
2958 | |
2959 if(proc) | |
2960 res = proc(hwnd, msg, mp1, mp2); | |
2961 else | |
2962 res = WinDefWindowProc(hwnd, msg, mp1, mp2); | |
2963 | |
2964 if(msg == WM_PAINT) | |
2965 { | |
2966 POINTL ptl; | |
2967 HPS hpsTemp; | |
2968 RECTL rcl; | |
2969 int height, width; | |
2970 | |
2971 WinQueryWindowRect(hwnd, &rcl); | |
2972 height = rcl.yTop - rcl.yBottom - 1; | |
2973 width = rcl.xRight - rcl.xLeft - 1; | |
2974 | |
2975 /* Draw a border around the bubble help */ | |
2976 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
|
2977 GpiSetColor(hpsTemp, CLR_BLACK); |
3 | 2978 ptl.x = ptl.y = 0; |
2979 GpiMove(hpsTemp, &ptl); | |
2980 ptl.x = 0; | |
2981 ptl.y = height; | |
2982 GpiLine(hpsTemp, &ptl); | |
2983 ptl.x = ptl.y = 0; | |
2984 GpiMove(hpsTemp, &ptl); | |
2985 ptl.y = 0; | |
2986 ptl.x = width; | |
2987 GpiLine(hpsTemp, &ptl); | |
2988 ptl.x = width; | |
2989 ptl.y = height; | |
2990 GpiMove(hpsTemp, &ptl); | |
2991 ptl.x = 0; | |
2992 ptl.y = height; | |
2993 GpiLine(hpsTemp, &ptl); | |
2994 ptl.x = width; | |
2995 ptl.y = height; | |
2996 GpiMove(hpsTemp, &ptl); | |
2997 ptl.y = 0; | |
2998 ptl.x = width; | |
2999 GpiLine(hpsTemp, &ptl); | |
3000 WinReleasePS(hpsTemp); | |
3001 } | |
3002 return res; | |
3003 } | |
3004 | |
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
|
3005 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
|
3006 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3007 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
|
3008 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
|
3009 MRESULT res; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3010 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3011 if(!oldproc) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3012 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
|
3013 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
|
3014 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3015 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3016 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3017 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
|
3018 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
|
3019 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3020 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
|
3021 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3022 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
|
3023 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
|
3024 |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
3025 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
|
3026 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
|
3027 else |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
3028 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
|
3029 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3030 return res; |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3031 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3032 |
3 | 3033 /* Function: BtProc |
3034 * Abstract: Subclass procedure for buttons | |
3035 */ | |
3036 | |
3037 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
3038 { | |
3039 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
|
3040 PFNWP oldproc; |
3 | 3041 |
3042 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER); | |
3043 | |
3044 if(!bubble) | |
3045 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
3046 | |
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
|
3047 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
|
3048 |
3 | 3049 switch(msg) |
3050 { | |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
3051 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3052 if(_wndproc(hwnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3053 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3054 break; |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
3055 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
|
3056 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
|
3057 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
|
3058 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
|
3059 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
|
3060 if(mp2) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3061 _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
|
3062 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3063 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3064 break; |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3065 case WM_BUTTON1DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3066 case WM_BUTTON2DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3067 case WM_BUTTON3DOWN: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3068 case WM_BUTTON1DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3069 case WM_BUTTON2DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3070 case WM_BUTTON3DBLCLK: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3071 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
|
3072 return (MRESULT)FALSE; |
368
72fbd1ee8150
Ug, missed a break statement.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
367
diff
changeset
|
3073 break; |
3 | 3074 case WM_BUTTON1UP: |
3075 { | |
3076 SignalHandler *tmp = Root; | |
3077 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3078 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled")) |
3 | 3079 { |
3080 /* Find any callbacks for this function */ | |
3081 while(tmp) | |
3082 { | |
3083 if(tmp->message == WM_COMMAND) | |
3084 { | |
3085 /* Make sure it's the right window, and the right ID */ | |
3086 if(tmp->window == hwnd) | |
3087 { | |
3088 /* Due to the fact that if we run the function | |
3089 * here, finishing actions on the button will occur | |
3090 * after we run the signal handler. So we post the | |
3091 * message so the button can finish what it needs to | |
3092 * do before we run our handler. | |
3093 */ | |
3094 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
3095 tmp = NULL; | |
3096 } | |
3097 } | |
3098 if(tmp) | |
3099 tmp= tmp->next; | |
3100 } | |
3101 } | |
3102 } | |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
3103 break; |
3 | 3104 case WM_USER: |
3105 { | |
3106 SignalHandler *tmp = (SignalHandler *)mp1; | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
3107 int (* API clickfunc)(HWND, void *) = NULL; |
3 | 3108 |
3109 if(tmp) | |
3110 { | |
175
d78d08440246
Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
174
diff
changeset
|
3111 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction; |
3 | 3112 |
3113 clickfunc(tmp->window, tmp->data); | |
3114 } | |
3115 } | |
3116 break; | |
3117 case WM_CHAR: | |
3118 { | |
3119 /* A button press should also occur for an ENTER or SPACE press | |
3120 * while the button has the active input focus. | |
3121 */ | |
3122 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') | |
3123 { | |
3124 SignalHandler *tmp = Root; | |
3125 | |
3126 /* Find any callbacks for this function */ | |
3127 while(tmp) | |
3128 { | |
3129 if(tmp->message == WM_COMMAND) | |
3130 { | |
3131 /* Make sure it's the right window, and the right ID */ | |
3132 if(tmp->window == hwnd) | |
3133 { | |
3134 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0); | |
3135 tmp = NULL; | |
3136 } | |
3137 } | |
3138 if(tmp) | |
3139 tmp= tmp->next; | |
3140 } | |
3141 } | |
3142 if(SHORT1FROMMP(mp2) == '\t') | |
3143 { | |
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
|
3144 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
|
3145 _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
|
3146 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
|
3147 _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
|
3148 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
|
3149 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
|
3150 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3151 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
|
3152 { |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3153 _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
|
3154 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
|
3155 } |
4a02842f8074
Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
60
diff
changeset
|
3156 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
|
3157 { |
3 | 3158 _shift_focus(hwnd); |
3159 return FALSE; | |
3160 } | |
3161 } | |
3162 break; | |
3163 case 0x041f: | |
3164 if (hwndBubble) | |
3165 { | |
3166 WinDestroyWindow(hwndBubble); | |
3167 hwndBubble = 0; | |
3168 } | |
3169 break; | |
3170 | |
3171 case 0x041e: | |
3172 | |
3173 if(!*bubble->bubbletext) | |
3174 break; | |
3175 | |
3176 if(hwndBubble) | |
3177 { | |
3178 WinDestroyWindow(hwndBubble); | |
3179 hwndBubble = 0; | |
3180 } | |
3181 | |
3182 if(!hwndBubble) | |
3183 { | |
3184 HPS hpsTemp = 0; | |
3185 LONG lHight; | |
3186 LONG lWidth; | |
3187 POINTL txtPointl[TXTBOX_COUNT]; | |
3188 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
|
3189 ULONG ulColor = CLR_YELLOW; |
3 | 3190 void *blah; |
3191 | |
3192 hwndBubbleLast = hwnd; | |
3193 hwndBubble = WinCreateWindow(HWND_DESKTOP, | |
3194 WC_STATIC, | |
3195 "", | |
3196 SS_TEXT | | |
3197 DT_CENTER | | |
3198 DT_VCENTER, | |
3199 0,0,0,0, | |
3200 HWND_DESKTOP, | |
3201 HWND_TOP, | |
3202 0, | |
3203 NULL, | |
3204 NULL); | |
3205 | |
3206 WinSetPresParam(hwndBubble, | |
3207 PP_FONTNAMESIZE, | |
363
eaebef97fc4f
Fixed using the default font in the bubble help.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
360
diff
changeset
|
3208 strlen(DefaultFont)+1, |
3 | 3209 DefaultFont); |
3210 | |
3211 | |
3212 WinSetPresParam(hwndBubble, | |
3213 PP_BACKGROUNDCOLORINDEX, | |
3214 sizeof(ulColor), | |
3215 &ulColor); | |
3216 | |
3217 WinSetWindowText(hwndBubble, | |
3218 bubble->bubbletext); | |
3219 | |
3220 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | |
3221 | |
3222 hpsTemp = WinGetPS(hwndBubble); | |
3223 GpiQueryTextBox(hpsTemp, | |
3224 strlen(bubble->bubbletext), | |
3225 bubble->bubbletext, | |
3226 TXTBOX_COUNT, | |
3227 txtPointl); | |
3228 WinReleasePS(hpsTemp); | |
3229 | |
3230 lWidth = txtPointl[TXTBOX_TOPRIGHT].x - | |
3231 txtPointl[TXTBOX_TOPLEFT ].x + 8; | |
3232 | |
3233 lHight = txtPointl[TXTBOX_TOPLEFT].y - | |
3234 txtPointl[TXTBOX_BOTTOMLEFT].y + 8; | |
3235 | |
3236 ptlWork.y -= lHight; | |
3237 | |
3238 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc); | |
3239 | |
3240 if(blah) | |
3241 WinSetWindowPtr(hwndBubble, QWP_USER, blah); | |
3242 | |
3243 WinSetWindowPos(hwndBubble, | |
3244 HWND_TOP, | |
3245 ptlWork.x, | |
3246 ptlWork.y, | |
3247 lWidth, | |
3248 lHight, | |
3249 SWP_SIZE | SWP_MOVE | SWP_SHOW); | |
3250 } | |
3251 break; | |
3252 } | |
3253 | |
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
|
3254 if(!oldproc) |
3 | 3255 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
|
3256 return oldproc(hwnd, msg, mp1, mp2); |
3 | 3257 } |
3258 | |
3259 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | |
3260 { | |
3261 int res = 0; | |
3262 res = (int)_run_event(hwnd, msg, mp1, mp2); | |
3263 switch(msg) | |
3264 { | |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
3265 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3266 if(_wndproc(hwnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3267 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3268 break; |
3 | 3269 case WM_BUTTON1DOWN: |
3270 case WM_BUTTON2DOWN: | |
3271 case WM_BUTTON3DOWN: | |
267
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3272 if(res == -1) |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3273 WinSetFocus(HWND_DESKTOP, hwnd); |
bf8b907f8a29
Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
257
diff
changeset
|
3274 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
|
3275 return (MPARAM)TRUE; |
3 | 3276 } |
3277 return WinDefWindowProc(hwnd, msg, mp1, mp2); | |
3278 } | |
3279 | |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3280 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
|
3281 { |
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
|
3282 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
|
3283 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
|
3284 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3285 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
|
3286 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
|
3287 |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3288 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
|
3289 { |
529
82a203664aa9
Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
527
diff
changeset
|
3290 case WM_MOUSEMOVE: |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3291 if(_wndproc(hwnd, msg, mp1, mp2)) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3292 return MPFROMSHORT(FALSE); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3293 break; |
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
|
3294 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
|
3295 { |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3296 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
|
3297 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
|
3298 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
|
3299 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3300 if(oldproc) |
129
e47c52b37cdd
Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
128
diff
changeset
|
3301 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
|
3302 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3303 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
|
3304 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
|
3305 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
|
3306 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
|
3307 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
|
3308 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
|
3309 |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3310 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
|
3311 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
|
3312 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
|
3313 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
|
3314 } |
ac616f625443
Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
127
diff
changeset
|
3315 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
|
3316 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
|
3317 _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
|
3318 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
|
3319 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
|
3320 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
|
3321 { |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3322 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
|
3323 _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
|
3324 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
|
3325 _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
|
3326 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
|
3327 } |
ab9b0fa6c66e
Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
63
diff
changeset
|
3328 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
|
3329 } |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3330 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3331 _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
|
3332 |
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
|
3333 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
|
3334 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
|
3335 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3336 return WinDefWindowProc(hwnd, msg, mp1, mp2); |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3337 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
3338 |
3 | 3339 /* |
3340 * Initializes the Dynamic Windows engine. | |
3341 * Parameters: | |
3342 * newthread: True if this is the only thread. | |
3343 * False if there is already a message loop running. | |
3344 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3345 int API dw_init(int newthread, int argc, char *argv[]) |
3 | 3346 { |
3347 APIRET rc; | |
3348 | |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3349 argc = argc; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3350 argv = argv; /* keep compiler happy */ |
3 | 3351 if(newthread) |
3352 { | |
3353 dwhab = WinInitialize(0); | |
3354 dwhmq = WinCreateMsgQueue(dwhab, 0); | |
3355 } | |
3356 | |
3357 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | |
3358 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); | |
3359 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3360 /* Get the OS/2 version. */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
3361 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
|
3362 |
190
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3363 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); |
f4c9fa77136a
A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
185
diff
changeset
|
3364 |
360
cf66410d03b4
Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
356
diff
changeset
|
3365 if(!IS_WARP4()) |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3366 DefaultFont = "8.Helv"; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3367 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3368 /* This is a window that hangs around as long as the |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3369 * application does and handles menu messages. |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3370 */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3371 hwndApp = dw_window_new(HWND_OBJECT, "", 0); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
3372 |
3 | 3373 return rc; |
3374 } | |
3375 | |
3376 /* | |
3377 * 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
|
3378 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3379 void API dw_main(void) |
3 | 3380 { |
3381 QMSG qmsg; | |
3382 | |
3383 _dwtid = dw_thread_id(); | |
3384 | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3385 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
|
3386 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3387 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
|
3388 _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
|
3389 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
|
3390 } |
3 | 3391 |
150
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3392 WinDestroyMsgQueue(dwhmq); |
2a0d7b57a6da
Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
147
diff
changeset
|
3393 WinTerminate(dwhab); |
3 | 3394 } |
3395 | |
3396 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3397 * 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
|
3398 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
3399 * 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
|
3400 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3401 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
|
3402 { |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3403 QMSG qmsg; |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3404 #ifdef __EMX__ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3405 struct timeval tv, start; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3406 |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3407 gettimeofday(&start, NULL); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3408 gettimeofday(&tv, NULL); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3409 |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3410 while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3411 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3412 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3413 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3414 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3415 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3416 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3417 WinDispatchMsg(dwhab, &qmsg); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3418 } |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3419 else |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3420 DosSleep(1); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3421 gettimeofday(&tv, NULL); |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3422 } |
477
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3423 #else |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3424 double start = (double)clock(); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3425 |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3426 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds) |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3427 { |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3428 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3429 { |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3430 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3431 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3432 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3433 WinDispatchMsg(dwhab, &qmsg); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3434 } |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3435 else |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3436 DosSleep(1); |
923b46b0716c
Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
476
diff
changeset
|
3437 } |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3438 #endif |
37
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3439 } |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3440 |
360bc6a5f1c9
Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
34
diff
changeset
|
3441 /* |
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
|
3442 * 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
|
3443 */ |
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
|
3444 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
|
3445 { |
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
|
3446 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
|
3447 |
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
|
3448 _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
|
3449 |
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
|
3450 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
|
3451 { |
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
|
3452 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
|
3453 _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
|
3454 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
|
3455 } |
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
|
3456 } |
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
|
3457 |
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
|
3458 /* |
3 | 3459 * Free's memory allocated by dynamic windows. |
3460 * Parameters: | |
3461 * ptr: Pointer to dynamic windows allocated | |
3462 * memory to be free()'d. | |
3463 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3464 void API dw_free(void *ptr) |
3 | 3465 { |
3466 free(ptr); | |
3467 } | |
3468 | |
3469 /* | |
3470 * Allocates and initializes a dialog struct. | |
3471 * Parameters: | |
3472 * data: User defined data to be passed to functions. | |
3473 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3474 DWDialog * API dw_dialog_new(void *data) |
3 | 3475 { |
3476 DWDialog *tmp = malloc(sizeof(DWDialog)); | |
3477 | |
3478 tmp->eve = dw_event_new(); | |
3479 dw_event_reset(tmp->eve); | |
3480 tmp->data = data; | |
3481 tmp->done = FALSE; | |
3482 tmp->result = NULL; | |
3483 | |
3484 return tmp; | |
3485 } | |
3486 | |
3487 /* | |
3488 * Accepts a dialog struct and returns the given data to the | |
3489 * initial called of dw_dialog_wait(). | |
3490 * Parameters: | |
3491 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3492 * result: Data to be returned by dw_dialog_wait(). | |
3493 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3494 int API dw_dialog_dismiss(DWDialog *dialog, void *result) |
3 | 3495 { |
3496 dialog->result = result; | |
3497 dw_event_post(dialog->eve); | |
3498 dialog->done = TRUE; | |
3499 return 0; | |
3500 } | |
3501 | |
3502 /* | |
3503 * Accepts a dialog struct waits for dw_dialog_dismiss() to be | |
3504 * called by a signal handler with the given dialog struct. | |
3505 * Parameters: | |
3506 * dialog: Pointer to a dialog struct aquired by dw_dialog_new). | |
3507 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3508 void * API dw_dialog_wait(DWDialog *dialog) |
3 | 3509 { |
3510 QMSG qmsg; | |
3511 void *tmp; | |
3512 | |
3513 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | |
3514 { | |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
3515 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
|
3516 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
3 | 3517 WinDispatchMsg(dwhab, &qmsg); |
3518 if(dialog->done) | |
3519 break; | |
3520 } | |
3521 dw_event_close(&dialog->eve); | |
3522 tmp = dialog->result; | |
3523 free(dialog); | |
3524 return tmp; | |
3525 } | |
3526 | |
3527 | |
3528 /* | |
3529 * Displays a Message Box with given text and title.. | |
3530 * Parameters: | |
3531 * 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
|
3532 * flags: flags to indicate buttons and icon |
3 | 3533 * format: printf style format string. |
3534 * ...: Additional variables for use in the format. | |
3535 */ | |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3536 int API dw_messagebox(char *title, int flags, char *format, ...) |
3 | 3537 { |
3538 va_list args; | |
3539 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
|
3540 int rc; |
3 | 3541 |
3542 va_start(args, format); | |
3543 vsprintf(outbuf, format, args); | |
3544 va_end(args); | |
3545 | |
458
768f3546c4b5
Don't make message boxes system modal on OS/2, it is very annoying.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
457
diff
changeset
|
3546 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, flags | MB_MOVEABLE); |
399
a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
377
diff
changeset
|
3547 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
|
3548 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
|
3549 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
|
3550 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
|
3551 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
|
3552 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
|
3553 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
|
3554 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
|
3555 else return 0; |
3 | 3556 } |
3557 | |
3558 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3559 * Makes the window topmost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3560 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3561 * 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
|
3562 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3563 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
|
3564 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3565 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
|
3566 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3567 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3568 /* |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3569 * Makes the window bottommost. |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3570 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3571 * 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
|
3572 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3573 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
|
3574 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3575 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
|
3576 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3577 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
3578 /* |
3 | 3579 * Makes the window visible. |
3580 * Parameters: | |
3581 * handle: The window handle to make visible. | |
3582 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3583 int API dw_window_show(HWND handle) |
3 | 3584 { |
3585 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW); | |
3586 HSWITCH hswitch; | |
3587 SWCNTRL swcntrl; | |
3588 | |
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
|
3589 _fix_button_owner(_toplevel_window(handle), 0); |
3 | 3590 WinSetFocus(HWND_DESKTOP, handle); |
3591 _initial_focus(handle); | |
3592 | |
3593 /* If this window has a switch list entry make sure it is visible */ | |
3594 hswitch = WinQuerySwitchHandle(handle, 0); | |
3595 if(hswitch) | |
3596 { | |
3597 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3598 swcntrl.uchVisibility = SWL_VISIBLE; | |
3599 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3600 } | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3601 if(WinWindowFromID(handle, FID_CLIENT)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3602 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3603 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3604 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3605 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
|
3606 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3607 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
|
3608 int newx, newy, changed = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3609 SWP swp; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3610 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3611 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3612 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3613 WinQueryWindowPos(handle, &swp); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3614 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3615 newx = swp.x; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3616 newy = swp.y; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3617 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3618 if((swp.x+swp.cx) > cx) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3619 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3620 newx = (cx - swp.cx)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3621 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3622 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3623 if((swp.y+swp.cy) > cy) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3624 { |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3625 newy = (cy - swp.cy)/2; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3626 changed = 1; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3627 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3628 if(changed) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3629 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
|
3630 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3631 } |
3 | 3632 return rc; |
3633 } | |
3634 | |
3635 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3636 * 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
|
3637 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3638 * handle: The window handle to minimize. |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3639 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3640 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
|
3641 { |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3642 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
|
3643 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3644 if(hwndclient) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3645 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3646 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
|
3647 |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3648 if(box) |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3649 { |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3650 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
|
3651 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
|
3652 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3653 } |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3654 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3655 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
|
3656 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3657 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
3658 /* |
3 | 3659 * Makes the window invisible. |
3660 * Parameters: | |
3661 * handle: The window handle to make visible. | |
3662 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3663 int API dw_window_hide(HWND handle) |
3 | 3664 { |
3665 HSWITCH hswitch; | |
3666 SWCNTRL swcntrl; | |
3667 | |
3668 /* If this window has a switch list entry make sure it is invisible */ | |
3669 hswitch = WinQuerySwitchHandle(handle, 0); | |
3670 if(hswitch) | |
3671 { | |
3672 WinQuerySwitchEntry(hswitch, &swcntrl); | |
3673 swcntrl.uchVisibility = SWL_INVISIBLE; | |
3674 WinChangeSwitchEntry(hswitch, &swcntrl); | |
3675 } | |
3676 return WinShowWindow(handle, FALSE); | |
3677 } | |
3678 | |
3679 /* | |
3680 * Destroys a window and all of it's children. | |
3681 * Parameters: | |
3682 * handle: The window handle to destroy. | |
3683 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3684 int API dw_window_destroy(HWND handle) |
3 | 3685 { |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3686 HWND frame, menu, 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
|
3687 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
|
3688 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3689 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
|
3690 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
|
3691 |
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
|
3692 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
|
3693 |
468
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3694 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3695 _free_menu_data(menu); |
0a2f13ba2d5c
More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
466
diff
changeset
|
3696 |
210
b9c7b762c104
When comparing the desktop value, use the queried value not the constant.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
207
diff
changeset
|
3697 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
|
3698 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3699 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
|
3700 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
|
3701 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3702 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
|
3703 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3704 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
|
3705 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
|
3706 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3707 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3708 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
|
3709 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
|
3710 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3711 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
|
3712 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3713 /* 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
|
3714 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
|
3715 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3716 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
|
3717 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3718 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
|
3719 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3720 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
|
3721 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3722 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3723 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
|
3724 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
|
3725 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
|
3726 _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
|
3727 } |
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
|
3728 return WinDestroyWindow(frame ? frame : handle); |
3 | 3729 } |
3730 | |
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
|
3731 /* 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
|
3732 * 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
|
3733 * 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
|
3734 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3735 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
|
3736 { |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3737 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
|
3738 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
|
3739 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
|
3740 |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
3741 _fix_button_owner(_toplevel_window(handle), 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
|
3742 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
|
3743 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3744 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
|
3745 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3746 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
|
3747 |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
3748 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
|
3749 _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
|
3750 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
|
3751 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3752 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
3753 |
3 | 3754 /* |
3755 * Changes a window's parent to newparent. | |
3756 * Parameters: | |
3757 * handle: The window handle to destroy. | |
3758 * newparent: The window's new parent window. | |
3759 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3760 void API dw_window_reparent(HWND handle, HWND newparent) |
3 | 3761 { |
3762 HWND blah = WinWindowFromID(newparent, FID_CLIENT); | |
3763 WinSetParent(handle, blah ? blah : newparent, TRUE); | |
3764 } | |
3765 | |
3766 /* | |
3767 * Sets the font used by a specified window (widget) handle. | |
3768 * Parameters: | |
3769 * handle: The window (widget) handle. | |
3770 * fontname: Name and size of the font in the form "size.fontname" | |
3771 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3772 int API dw_window_set_font(HWND handle, char *fontname) |
3 | 3773 { |
3774 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | |
3775 } | |
3776 | |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3777 /* Internal version */ |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3778 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back) |
3 | 3779 { |
3780 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR) | |
3781 { | |
3782 RGB2 rgb2; | |
3783 | |
3784 rgb2.bBlue = DW_BLUE_VALUE(fore); | |
3785 rgb2.bGreen = DW_GREEN_VALUE(fore); | |
3786 rgb2.bRed = DW_RED_VALUE(fore); | |
3787 rgb2.fcOptions = 0; | |
3788 | |
3789 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3790 | |
3791 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3792 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
|
3793 { |
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
|
3794 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
|
3795 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3796 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
|
3797 } |
3 | 3798 if((back & DW_RGB_COLOR) == DW_RGB_COLOR) |
3799 { | |
3800 RGB2 rgb2; | |
3801 | |
3802 rgb2.bBlue = DW_BLUE_VALUE(back); | |
3803 rgb2.bGreen = DW_GREEN_VALUE(back); | |
3804 rgb2.bRed = DW_RED_VALUE(back); | |
3805 rgb2.fcOptions = 0; | |
3806 | |
3807 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2); | |
3808 return 0; | |
3809 } | |
155
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3810 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
|
3811 { |
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
|
3812 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
|
3813 |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3814 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
|
3815 } |
840c54766306
Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
154
diff
changeset
|
3816 return 0; |
3 | 3817 } |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3818 /* |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3819 * 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
|
3820 * Parameters: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3821 * handle: The window (widget) handle. |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3822 * 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
|
3823 * 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
|
3824 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3825 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
|
3826 { |
228
326e114923cf
Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
225
diff
changeset
|
3827 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
|
3828 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
|
3829 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
3830 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
|
3831 } |
3 | 3832 |
3833 /* | |
3834 * Sets the font used by a specified window (widget) handle. | |
3835 * Parameters: | |
3836 * handle: The window (widget) handle. | |
3837 * border: Size of the window border in pixels. | |
3838 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3839 int API dw_window_set_border(HWND handle, int border) |
3 | 3840 { |
3841 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border)); | |
3842 return 0; | |
3843 } | |
3844 | |
3845 /* | |
3846 * Captures the mouse input to this window. | |
3847 * Parameters: | |
3848 * handle: Handle to receive mouse input. | |
3849 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3850 void API dw_window_capture(HWND handle) |
3 | 3851 { |
3852 WinSetCapture(HWND_DESKTOP, handle); | |
3853 } | |
3854 | |
3855 /* | |
3856 * Releases previous mouse capture. | |
3857 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3858 void API dw_window_release(void) |
3 | 3859 { |
3860 WinSetCapture(HWND_DESKTOP, NULLHANDLE); | |
3861 } | |
3862 | |
3863 /* | |
3864 * Tracks this window movement. | |
3865 * Parameters: | |
3866 * handle: Handle to frame to be tracked. | |
3867 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3868 void API dw_window_track(HWND handle) |
3 | 3869 { |
3870 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0); | |
3871 } | |
3872 | |
3873 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3874 * 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
|
3875 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3876 * 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
|
3877 * 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
|
3878 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
3879 void API dw_window_set_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
|
3880 { |
530
27533e1ccaf5
More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
529
diff
changeset
|
3881 HPOINTER pointer = pointertype < 65535 ? |
27533e1ccaf5
More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
529
diff
changeset
|
3882 WinQuerySysPointer(HWND_DESKTOP, pointertype, FALSE) |
27533e1ccaf5
More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
529
diff
changeset
|
3883 : (HPOINTER)pointertype; |
27533e1ccaf5
More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
529
diff
changeset
|
3884 |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3885 if(!pointertype) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3886 dw_window_set_data(handle, "_dw_pointer", 0); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3887 else |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3888 { |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3889 WinSetPointer(HWND_DESKTOP, pointer); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3890 |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3891 if(handle != HWND_DESKTOP) |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3892 dw_window_set_data(handle, "_dw_pointer", (void *)pointer); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
3893 } |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3894 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3895 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
3896 /* |
3 | 3897 * Create a new Window Frame. |
3898 * Parameters: | |
3899 * owner: The Owner's window handle or HWND_DESKTOP. | |
3900 * title: The Window title. | |
3901 * flStyle: Style flags, see the PM reference. | |
3902 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3903 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle) |
3 | 3904 { |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3905 HWND hwndframe; |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3906 Box *newbox = calloc(1, sizeof(Box)); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3907 WindowData *blah = calloc(1, sizeof(WindowData)); |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3908 ULONG winStyle = 0L; |
3 | 3909 |
3910 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
|
3911 newbox->type = DW_VERT; |
3 | 3912 newbox->count = 0; |
3913 | |
3914 flStyle |= FCF_NOBYTEALIGN; | |
3915 | |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3916 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
|
3917 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
|
3918 else |
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3919 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
|
3920 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3921 if(!(flStyle & FCF_SHELLPOSITION)) |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3922 blah->flags |= DW_OS2_NEW_WINDOW; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3923 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3924 if(flStyle & WS_MAXIMIZED) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3925 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3926 winStyle |= WS_MAXIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3927 flStyle &= ~WS_MAXIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3928 } |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3929 if(flStyle & WS_MINIMIZED) |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3930 { |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3931 winStyle |= WS_MINIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3932 flStyle &= ~WS_MINIMIZED; |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3933 } |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
3934 |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3935 hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &newbox->hwnd); |
39
3aa9ef0b3996
Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
38
diff
changeset
|
3936 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
|
3937 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
|
3938 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
3939 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc); |
3 | 3940 WinSetWindowPtr(hwndframe, QWP_USER, blah); |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3941 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); |
3 | 3942 |
3943 return hwndframe; | |
3944 } | |
3945 | |
3946 /* | |
3947 * Create a new Box to be packed. | |
3948 * 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
|
3949 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3950 * pad: Number of pixels to pad around the box. |
3951 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3952 HWND API dw_box_new(int type, int pad) |
3 | 3953 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3954 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3955 |
3956 newbox->pad = pad; | |
3957 newbox->type = type; | |
3958 newbox->count = 0; | |
3959 newbox->grouphwnd = NULLHANDLE; | |
3960 | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3961 newbox->hwnd = WinCreateWindow(HWND_OBJECT, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3962 WC_FRAME, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3963 NULL, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3964 WS_VISIBLE | WS_CLIPCHILDREN | |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3965 FS_NOBYTEALIGN, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3966 0,0,2000,1000, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3967 NULLHANDLE, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3968 HWND_TOP, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3969 0L, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3970 NULL, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3971 NULL); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3972 |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3973 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _controlproc); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3974 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3975 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3976 return newbox->hwnd; |
3 | 3977 } |
3978 | |
3979 /* | |
3980 * Create a new Group Box to be packed. | |
3981 * 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
|
3982 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3 | 3983 * pad: Number of pixels to pad around the box. |
3984 * title: Text to be displayined in the group outline. | |
3985 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
3986 HWND API dw_groupbox_new(int type, int pad, char *title) |
3 | 3987 { |
8
e22584460709
Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
7
diff
changeset
|
3988 Box *newbox = calloc(1, sizeof(Box)); |
3 | 3989 newbox->pad = pad; |
3990 newbox->type = type; | |
3991 newbox->count = 0; | |
3992 | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3993 newbox->hwnd = WinCreateWindow(HWND_OBJECT, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3994 WC_FRAME, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3995 NULL, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3996 WS_VISIBLE | |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3997 FS_NOBYTEALIGN, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3998 0,0,2000,1000, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
3999 NULLHANDLE, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4000 HWND_TOP, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4001 0L, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4002 NULL, |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4003 NULL); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4004 |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4005 newbox->grouphwnd = WinCreateWindow(newbox->hwnd, |
3 | 4006 WC_STATIC, |
4007 title, | |
4008 WS_VISIBLE | SS_GROUPBOX | | |
4009 WS_GROUP, | |
4010 0,0,2000,1000, | |
4011 NULLHANDLE, | |
4012 HWND_TOP, | |
4013 0L, | |
4014 NULL, | |
4015 NULL); | |
4016 | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4017 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4018 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
3 | 4019 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
4020 dw_window_set_font(newbox->grouphwnd, DefaultFont); | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
4021 return newbox->hwnd; |
3 | 4022 } |
4023 | |
4024 /* | |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4025 * 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
|
4026 * Parameters: |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4027 * 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
|
4028 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4029 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
|
4030 { |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4031 HWND hwndframe; |
523
b2065b0c39c1
Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
4032 ULONG back = CLR_DARKGRAY; |
b2065b0c39c1
Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
4033 |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4034 hwndframe = WinCreateWindow(HWND_OBJECT, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4035 WC_FRAME, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4036 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
|
4037 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
|
4038 FS_NOBYTEALIGN, |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4039 0,0,2000,1000, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4040 NULLHANDLE, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4041 HWND_TOP, |
523
b2065b0c39c1
Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
4042 id, |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4043 NULL, |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4044 NULL); |
523
b2065b0c39c1
Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
4045 /* Make the MDI Client area the same color as Windows and Unix */ |
b2065b0c39c1
Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
516
diff
changeset
|
4046 WinSetPresParam(hwndframe, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back); |
14
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4047 return hwndframe; |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4048 } |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4049 |
176cee043f1b
Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
12
diff
changeset
|
4050 /* |
3 | 4051 * Create a bitmap object to be packed. |
4052 * 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
|
4053 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4054 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4055 HWND API dw_bitmap_new(ULONG id) |
3 | 4056 { |
4057 return WinCreateWindow(HWND_OBJECT, | |
4058 WC_STATIC, | |
4059 NULL, | |
4060 WS_VISIBLE | SS_TEXT, | |
4061 0,0,2000,1000, | |
4062 NULLHANDLE, | |
4063 HWND_TOP, | |
4064 id, | |
4065 NULL, | |
4066 NULL); | |
4067 } | |
4068 | |
4069 /* | |
4070 * Create a notebook object to be packed. | |
4071 * Parameters: | |
4072 * id: An ID to be used for getting the resource from the | |
4073 * resource file. | |
4074 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4075 HWND API dw_notebook_new(ULONG id, int top) |
3 | 4076 { |
4077 ULONG flags; | |
4078 HWND tmp; | |
4079 | |
4080 if(top) | |
4081 flags = BKS_MAJORTABTOP; | |
4082 else | |
4083 flags = BKS_MAJORTABBOTTOM; | |
4084 | |
4085 tmp = WinCreateWindow(HWND_OBJECT, | |
4086 WC_NOTEBOOK, | |
4087 NULL, | |
4088 WS_VISIBLE | | |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4089 #ifdef BKS_TABBEDDIALOG |
3 | 4090 BKS_TABBEDDIALOG | |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4091 #endif |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4092 flags, |
3 | 4093 0,0,2000,1000, |
4094 NULLHANDLE, | |
4095 HWND_TOP, | |
4096 id, | |
4097 NULL, | |
4098 NULL); | |
4099 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4100 /* Fix tab sizes on Warp 3 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4101 if(!IS_WARP4()) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4102 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4103 /* 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
|
4104 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
|
4105 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
4106 |
3 | 4107 dw_window_set_font(tmp, DefaultFont); |
4108 return tmp; | |
4109 } | |
4110 | |
4111 /* | |
4112 * Create a menu object to be popped up. | |
4113 * Parameters: | |
4114 * id: An ID to be used for getting the resource from the | |
4115 * resource file. | |
4116 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4117 HMENUI API dw_menu_new(ULONG id) |
3 | 4118 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4119 HMENUI tmp = WinCreateWindow(HWND_OBJECT, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4120 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4121 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4122 WS_VISIBLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4123 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4124 NULLHANDLE, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4125 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4126 id, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4127 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4128 NULL); |
3 | 4129 return tmp; |
4130 } | |
4131 | |
4132 /* | |
4133 * Create a menubar on a window. | |
4134 * Parameters: | |
4135 * location: Handle of a window frame to be attached to. | |
4136 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4137 HMENUI API dw_menubar_new(HWND location) |
3 | 4138 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4139 HMENUI tmp = WinCreateWindow(location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4140 WC_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4141 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4142 WS_VISIBLE | MS_ACTIONBAR, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4143 0,0,2000,1000, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4144 location, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4145 HWND_TOP, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4146 FID_MENU, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4147 NULL, |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4148 NULL); |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4149 dw_window_set_data(tmp, "_dw_owner", (void *)location); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4150 dw_window_set_data(tmp, "_dw_menubar", (void *)location); |
3 | 4151 return tmp; |
4152 } | |
4153 | |
4154 /* | |
4155 * Destroys a menu created with dw_menubar_new or dw_menu_new. | |
4156 * Parameters: | |
4157 * menu: Handle of a menu. | |
4158 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4159 void API dw_menu_destroy(HMENUI *menu) |
3 | 4160 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4161 if(menu) |
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4162 WinDestroyWindow(*menu); |
3 | 4163 } |
4164 | |
4165 /* | |
4166 * Adds a menuitem or submenu to an existing menu. | |
4167 * Parameters: | |
4168 * menu: The handle the the existing menu. | |
4169 * title: The title text on the menu item to be added. | |
4170 * id: An ID to be used for message passing. | |
4171 * flags: Extended attributes to set on the menu. | |
4172 * end: If TRUE memu is positioned at the end of the menu. | |
4173 * check: If TRUE menu is "check"able. | |
4174 * submenu: Handle to an existing menu to be a submenu or NULL. | |
4175 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4176 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu) |
3 | 4177 { |
4178 MENUITEM miSubMenu; | |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4179 char buffer[15]; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4180 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4181 check = check; /* keep compiler happy */ |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4182 if(!menux || id > 65536) |
3 | 4183 return NULLHANDLE; |
4184 | |
4185 if(end) | |
4186 miSubMenu.iPosition=MIT_END; | |
4187 else | |
4188 miSubMenu.iPosition=0; | |
4189 | |
4190 if(strlen(title) == 0) | |
4191 miSubMenu.afStyle=MIS_SEPARATOR | flags; | |
4192 else | |
4193 miSubMenu.afStyle=MIS_TEXT | flags; | |
4194 miSubMenu.afAttribute=0; | |
4195 miSubMenu.id=id; | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4196 miSubMenu.hwndSubMenu = submenu; |
3 | 4197 miSubMenu.hItem=NULLHANDLE; |
4198 | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4199 WinSendMsg(menux, |
3 | 4200 MM_INSERTITEM, |
4201 MPFROMP(&miSubMenu), | |
4202 MPFROMP(title)); | |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4203 |
543
8217ee5c254e
Get EMX compiling again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
541
diff
changeset
|
4204 sprintf(buffer, "_dw_id%d", (int)id); |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4205 dw_window_set_data(hwndApp, buffer, (void *)menux); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4206 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4207 if(submenu) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
4208 dw_window_set_data(submenu, "_dw_owner", (void *)menux); |
3 | 4209 return (HWND)id; |
4210 } | |
4211 | |
4212 /* | |
4213 * Sets the state of a menu item check. | |
4214 * Parameters: | |
4215 * menu: The handle the the existing menu. | |
4216 * id: Menuitem id. | |
4217 * check: TRUE for checked FALSE for not checked. | |
4218 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4219 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check) |
3 | 4220 { |
4221 if(check) | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4222 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 4223 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)); |
4224 else | |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4225 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), |
3 | 4226 MPFROM2SHORT(MIA_CHECKED, 0)); |
4227 } | |
4228 | |
4229 /* | |
4230 * Pops up a context menu at given x and y coordinates. | |
4231 * Parameters: | |
4232 * menu: The handle the the existing menu. | |
4233 * parent: Handle to the window initiating the popup. | |
4234 * x: X coordinate. | |
4235 * y: Y coordinate. | |
4236 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4237 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y) |
3 | 4238 { |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4239 if(menu) |
3 | 4240 { |
93
98cce029a611
Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
90
diff
changeset
|
4241 popup = parent; |
499
b658d9628f41
Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
498
diff
changeset
|
4242 dw_window_set_data(*menu, "_dw_popup", (void *)1); |
185
f55677513954
Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
183
diff
changeset
|
4243 WinPopupMenu(HWND_DESKTOP, parent, *menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN); |
3 | 4244 } |
4245 } | |
4246 | |
4247 /* | |
4248 * Returns the current X and Y coordinates of the mouse pointer. | |
4249 * Parameters: | |
4250 * x: Pointer to variable to store X coordinate. | |
4251 * y: Pointer to variable to store Y coordinate. | |
4252 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4253 void API dw_pointer_query_pos(long *x, long *y) |
3 | 4254 { |
4255 POINTL ptl; | |
4256 | |
4257 WinQueryPointerPos(HWND_DESKTOP, &ptl); | |
4258 if(x && y) | |
4259 { | |
4260 *x = ptl.x; | |
4261 *y = dw_screen_height() - ptl.y; | |
4262 } | |
4263 } | |
4264 | |
4265 /* | |
4266 * Sets the X and Y coordinates of the mouse pointer. | |
4267 * Parameters: | |
4268 * x: X coordinate. | |
4269 * y: Y coordinate. | |
4270 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4271 void API dw_pointer_set_pos(long x, long y) |
3 | 4272 { |
4273 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y); | |
4274 } | |
4275 | |
310
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
4276 |
3 | 4277 /* |
4278 * Create a container object to be packed. | |
4279 * Parameters: | |
4280 * id: An ID to be used for getting the resource from the | |
4281 * resource file. | |
4282 */ | |
350
2216e65ad2ae
Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
347
diff
changeset
|
4283 HWND API dw_container_new(ULONG id, int multi) |
3 | 4284 { |
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
|
4285 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4286 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4287 WC_CONTAINER, | |
4288 NULL, | |
4289 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
|
4290 (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
|
4291 CCS_AUTOPOSITION, |
3 | 4292 0,0,2000,1000, |
4293 NULLHANDLE, | |
4294 HWND_TOP, | |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4295 id ? id : (GlobalID++), |
3 | 4296 NULL, |
4297 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
|
4298 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
|
4299 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4300 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
|
4301 dw_window_set_data(tmp, "_dw_container", (void *)1); |
3 | 4302 return tmp; |
4303 } | |
4304 | |
4305 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4306 * 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
|
4307 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4308 * 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
|
4309 * 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
|
4310 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4311 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
|
4312 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4313 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
|
4314 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
|
4315 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
|
4316 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
|
4317 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4318 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
|
4319 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
|
4320 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
|
4321 NULLHANDLE, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4322 HWND_TOP, |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4323 id ? id : (GlobalID++), |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4324 NULL, |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4325 NULL); |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4326 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4327 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
|
4328 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
|
4329 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
|
4330 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
|
4331 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
|
4332 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
|
4333 |
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
|
4334 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
|
4335 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
|
4336 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
|
4337 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
|
4338 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
|
4339 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
|
4340 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4341 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
4342 /* |
3 | 4343 * Create a new static text window (widget) to be packed. |
4344 * Parameters: | |
4345 * 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
|
4346 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4347 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4348 HWND API dw_text_new(char *text, ULONG id) |
3 | 4349 { |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
4350 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4351 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4352 WC_STATIC, | |
4353 text, | |
4354 WS_VISIBLE | SS_TEXT, | |
4355 0,0,2000,1000, | |
4356 NULLHANDLE, | |
4357 HWND_TOP, | |
4358 id, | |
4359 NULL, | |
4360 NULL); | |
531
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
4361 blah->oldproc = WinSubclassWindow(tmp, _textproc); |
79696a852401
Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
530
diff
changeset
|
4362 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4363 dw_window_set_font(tmp, DefaultFont); |
4364 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4365 return tmp; | |
4366 } | |
4367 | |
4368 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4369 * 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
|
4370 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4371 * 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
|
4372 * 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
|
4373 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4374 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
|
4375 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4376 WindowData *blah = calloc(sizeof(WindowData), 1); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4377 HWND tmp = WinCreateWindow(HWND_OBJECT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4378 WC_STATIC, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4379 text, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4380 WS_VISIBLE | SS_TEXT, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4381 0,0,2000,1000, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4382 NULLHANDLE, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4383 HWND_TOP, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4384 id, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4385 NULL, |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4386 NULL); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4387 blah->oldproc = WinSubclassWindow(tmp, _statusproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4388 WinSetWindowPtr(tmp, QWP_USER, blah); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4389 dw_window_set_font(tmp, DefaultFont); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4390 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
|
4391 return tmp; |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4392 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4393 |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4394 #ifndef MLS_LIMITVSCROLL |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4395 #define MLS_LIMITVSCROLL 0x00000080L |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4396 #endif |
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
4397 |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
4398 /* |
3 | 4399 * Create a new Multiline Editbox window (widget) to be packed. |
4400 * 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
|
4401 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4402 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4403 HWND API dw_mle_new(ULONG id) |
3 | 4404 { |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4405 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4406 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4407 WC_MLE, | |
4408 "", | |
4409 WS_VISIBLE | | |
4410 MLS_BORDER | MLS_IGNORETAB | | |
152
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4411 MLS_READONLY | MLS_VSCROLL | |
e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
151
diff
changeset
|
4412 MLS_LIMITVSCROLL, |
3 | 4413 0,0,2000,1000, |
4414 NULLHANDLE, | |
4415 HWND_TOP, | |
4416 id, | |
4417 NULL, | |
4418 NULL); | |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
4419 blah->oldproc = WinSubclassWindow(tmp, _mleproc); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4420 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4421 dw_window_set_font(tmp, DefaultFont); |
3 | 4422 return tmp; |
4423 } | |
4424 | |
4425 /* | |
4426 * Create a new Entryfield window (widget) to be packed. | |
4427 * Parameters: | |
4428 * 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
|
4429 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4430 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4431 HWND API dw_entryfield_new(char *text, ULONG id) |
3 | 4432 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4433 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4434 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4435 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4436 WC_ENTRYFIELD, | |
4437 text, | |
4438 WS_VISIBLE | ES_MARGIN | | |
4439 ES_AUTOSCROLL | WS_TABSTOP, | |
4440 0,0,2000,1000, | |
4441 NULLHANDLE, | |
4442 HWND_TOP, | |
4443 id, | |
4444 NULL, | |
4445 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4446 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4447 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4448 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
|
4449 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4450 return tmp; |
4451 } | |
4452 | |
4453 /* | |
4454 * Create a new Entryfield (password) window (widget) to be packed. | |
4455 * Parameters: | |
4456 * 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
|
4457 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4458 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4459 HWND API dw_entryfield_password_new(char *text, ULONG id) |
3 | 4460 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4461 WindowData *blah = calloc(1, sizeof(WindowData)); |
3 | 4462 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4463 WC_ENTRYFIELD, | |
4464 text, | |
4465 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE | | |
4466 ES_AUTOSCROLL | WS_TABSTOP, | |
4467 0,0,2000,1000, | |
4468 NULLHANDLE, | |
4469 HWND_TOP, | |
4470 id, | |
4471 NULL, | |
4472 NULL); | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4473 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4474 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4475 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
|
4476 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4477 return tmp; |
4478 } | |
4479 | |
4480 /* | |
4481 * Create a new Combobox window (widget) to be packed. | |
4482 * Parameters: | |
4483 * 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
|
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_combobox_new(char *text, ULONG id) |
3 | 4487 { |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4488 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
|
4489 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
|
4490 HWND tmp = WinCreateWindow(frame, |
3 | 4491 WC_COMBOBOX, |
4492 text, | |
4493 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, | |
4494 0,0,2000,1000, | |
4495 NULLHANDLE, | |
4496 HWND_TOP, | |
4497 id, | |
4498 NULL, | |
4499 NULL); | |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4500 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
|
4501 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
|
4502 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4503 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
|
4504 { |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4505 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
|
4506 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4507 WinSetWindowPtr(child, QWP_USER, moreblah); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
4508 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
|
4509 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
|
4510 } |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
4511 WinEndEnumWindows(henum); |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
4512 blah->oldproc = WinSubclassWindow(tmp, _comboproc); |
3 | 4513 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4514 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
|
4515 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
|
4516 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
|
4517 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
|
4518 WinSetOwner(tmp, frame); |
3 | 4519 return tmp; |
4520 } | |
4521 | |
4522 /* | |
4523 * Create a new button window (widget) to be packed. | |
4524 * Parameters: | |
4525 * 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
|
4526 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4527 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4528 HWND API dw_button_new(char *text, ULONG id) |
3 | 4529 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4530 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4531 |
4532 HWND tmp = WinCreateWindow(HWND_OBJECT, | |
4533 WC_BUTTON, | |
4534 text, | |
4535 WS_VISIBLE, | |
4536 0,0,2000,1000, | |
4537 NULLHANDLE, | |
4538 HWND_TOP, | |
4539 id, | |
4540 NULL, | |
4541 NULL); | |
4542 | |
4543 bubble->id = id; | |
4544 bubble->bubbletext[0] = '\0'; | |
4545 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4546 | |
4547 WinSetWindowPtr(tmp, QWP_USER, bubble); | |
4548 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
|
4549 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4550 return tmp; |
4551 } | |
4552 | |
4553 /* Function: GenResIDStr | |
4554 ** Abstract: Generate string '#nnnn' for a given ID for using with Button | |
4555 ** controls | |
4556 */ | |
4557 | |
4558 void _GenResIDStr(CHAR *buff, ULONG ulID) | |
4559 { | |
4560 char *str; | |
4561 int slen = 0; | |
4562 | |
4563 *buff++ = '#'; | |
4564 | |
4565 str = buff; | |
4566 | |
4567 do | |
4568 { | |
4569 *str++ = (ulID % 10) + '0'; | |
4570 ulID /= 10; | |
4571 slen++; | |
4572 } | |
4573 while(ulID); | |
4574 | |
4575 *str-- = 0; | |
4576 | |
4577 for(; str > buff; str--, buff++) | |
4578 { | |
4579 *buff ^= *str; | |
4580 *str ^= *buff; | |
4581 *buff ^= *str; | |
4582 } | |
4583 } | |
4584 | |
4585 | |
4586 /* | |
4587 * Create a new bitmap button window (widget) to be packed. | |
4588 * Parameters: | |
4589 * text: Bubble help text to be displayed. | |
4590 * id: An ID of a bitmap in the resource file. | |
4591 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4592 HWND API dw_bitmapbutton_new(char *text, ULONG id) |
3 | 4593 { |
4594 char idbuf[256]; | |
4595 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
|
4596 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4597 |
4598 _GenResIDStr(idbuf, id); | |
4599 | |
4600 tmp = WinCreateWindow(HWND_OBJECT, | |
4601 WC_BUTTON, | |
4602 idbuf, | |
4603 WS_VISIBLE | BS_PUSHBUTTON | | |
4604 BS_BITMAP | BS_AUTOSIZE | | |
4605 BS_NOPOINTERFOCUS, | |
4606 0,0,2000,1000, | |
4607 NULLHANDLE, | |
4608 HWND_TOP, | |
4609 id, | |
4610 NULL, | |
4611 NULL); | |
4612 | |
4613 bubble->id = id; | |
4614 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); | |
4615 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; | |
4616 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); | |
4617 | |
4618 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
|
4619 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1); |
3 | 4620 return tmp; |
4621 } | |
4622 | |
4623 /* | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4624 * 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
|
4625 * Parameters: |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4626 * 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
|
4627 * 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
|
4628 * 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
|
4629 * 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
|
4630 * (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
|
4631 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
4632 HWND API 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
|
4633 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4634 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
|
4635 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
|
4636 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
|
4637 "", |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4638 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
|
4639 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
|
4640 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
|
4641 NULLHANDLE, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4642 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
|
4643 id, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4644 NULL, |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4645 NULL); |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4646 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
|
4647 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
|
4648 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4649 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
|
4650 { |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4651 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
|
4652 LONG fore; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4653 |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4654 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
|
4655 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4656 /* 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
|
4657 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
|
4658 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4659 /* 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
|
4660 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
|
4661 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
|
4662 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4663 #if 0 /* don't free pixmap if bitmap doesn't exist; causes crash several lines below */ |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4664 free(pixmap); |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4665 pixmap = NULL; |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
4666 #endif |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4667 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4668 } |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4669 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4670 /* 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
|
4671 if(pixmap) |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4672 _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
|
4673 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4674 /* Create a disabled style pixmap */ |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
4675 disabled = dw_pixmap_new(tmp, pixmap->width, pixmap->height, dw_color_depth_get()); |
367
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4676 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
|
4677 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4678 fore = _foreground; |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4679 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
|
4680 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
|
4681 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
|
4682 { |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4683 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
|
4684 |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4685 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
|
4686 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
|
4687 } |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
4688 _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
|
4689 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4690 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4691 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
|
4692 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
|
4693 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
|
4694 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
|
4695 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4696 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
|
4697 |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4698 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
|
4699 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
|
4700 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
|
4701 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
|
4702 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4703 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4704 /* |
3 | 4705 * Create a new spinbutton window (widget) to be packed. |
4706 * Parameters: | |
4707 * 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
|
4708 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4709 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4710 HWND API dw_spinbutton_new(char *text, ULONG id) |
3 | 4711 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4712 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4713 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4714 WC_SPINBUTTON, | |
4715 text, | |
4716 WS_VISIBLE | SPBS_MASTER, | |
4717 0,0,2000,1000, | |
4718 NULLHANDLE, | |
4719 HWND_TOP, | |
4720 id, | |
4721 NULL, | |
4722 NULL); | |
156 | 4723 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
|
4724 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
3 | 4725 WinSetWindowPtr(tmp, QWP_USER, blah); |
156 | 4726 blah = calloc(sizeof(WindowData), 1); |
4727 blah->oldproc = WinSubclassWindow(entry, _spinentryproc); | |
4728 WinSetWindowPtr(entry, QWP_USER, blah); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4729 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
|
4730 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4731 return tmp; |
4732 } | |
4733 | |
4734 /* | |
4735 * Create a new radiobutton window (widget) to be packed. | |
4736 * Parameters: | |
4737 * 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
|
4738 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4739 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4740 HWND API dw_radiobutton_new(char *text, ULONG id) |
3 | 4741 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4742 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4743 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4744 WC_BUTTON, | |
4745 text, | |
4746 WS_VISIBLE | | |
4747 BS_AUTORADIOBUTTON, | |
4748 0,0,2000,1000, | |
4749 NULLHANDLE, | |
4750 HWND_TOP, | |
4751 id, | |
4752 NULL, | |
4753 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4754 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4755 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4756 dw_window_set_font(tmp, DefaultFont); |
4757 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | |
4758 return tmp; | |
4759 } | |
4760 | |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4761 |
3 | 4762 /* |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4763 * 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
|
4764 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4765 * 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
|
4766 * 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
|
4767 * 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
|
4768 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4769 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
|
4770 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4771 WindowData *blah = calloc(1, sizeof(WindowData)); |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4772 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
|
4773 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
|
4774 |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4775 sldcData.cbSize = sizeof(SLDCDATA); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
4776 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
|
4777 |
178
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4778 tmp = WinCreateWindow(HWND_OBJECT, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4779 WC_SLIDER, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4780 "", |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4781 WS_VISIBLE | SLS_SNAPTOINCREMENT | |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4782 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4783 0,0,2000,1000, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4784 NULLHANDLE, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4785 HWND_TOP, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4786 id, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4787 &sldcData, |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4788 NULL); |
770da0fc4c0d
Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
175
diff
changeset
|
4789 |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4790 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
|
4791 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
|
4792 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
|
4793 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4794 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
4795 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4796 * 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
|
4797 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4798 * 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
|
4799 * 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
|
4800 * 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
|
4801 */ |
511
80dbd5a1f403
Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
510
diff
changeset
|
4802 HWND API dw_scrollbar_new(int vertical, ULONG id) |
80dbd5a1f403
Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
510
diff
changeset
|
4803 { |
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
|
4804 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
|
4805 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
|
4806 "", |
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
|
4807 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
|
4808 (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
|
4809 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
|
4810 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
|
4811 HWND_TOP, |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4812 id ? id : (GlobalID++), |
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
|
4813 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
|
4814 NULL); |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4815 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4816 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
4817 /* |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4818 * Create a new percent bar window (widget) to be packed. |
3 | 4819 * 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
|
4820 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4821 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4822 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
|
4823 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
4824 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
|
4825 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
|
4826 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
|
4827 "", |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4828 WS_VISIBLE | SLS_READONLY |
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
4829 | 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
|
4830 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
|
4831 NULLHANDLE, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4832 HWND_TOP, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4833 id, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4834 NULL, |
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
4835 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
|
4836 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
|
4837 WinSetWindowPtr(tmp, QWP_USER, blah); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4838 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
|
4839 return tmp; |
3 | 4840 } |
4841 | |
4842 /* | |
4843 * Create a new checkbox window (widget) to be packed. | |
4844 * Parameters: | |
4845 * 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
|
4846 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4847 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4848 HWND API dw_checkbox_new(char *text, ULONG id) |
3 | 4849 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4850 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); |
3 | 4851 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4852 WC_BUTTON, | |
4853 text, | |
4854 WS_VISIBLE | BS_AUTOCHECKBOX, | |
4855 0,0,2000,1000, | |
4856 NULLHANDLE, | |
4857 HWND_TOP, | |
4858 id, | |
4859 NULL, | |
4860 NULL); | |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4861 bubble->id = id; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4862 bubble->bubbletext[0] = '\0'; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4863 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
4864 WinSetWindowPtr(tmp, QWP_USER, bubble); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4865 dw_window_set_font(tmp, DefaultFont); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4866 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
3 | 4867 return tmp; |
4868 } | |
4869 | |
4870 /* | |
4871 * Create a new listbox window (widget) to be packed. | |
4872 * 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
|
4873 * id: An ID to be used with dw_window_from_id() or 0L. |
3 | 4874 * multi: Multiple select TRUE or FALSE. |
4875 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4876 HWND API dw_listbox_new(ULONG id, int multi) |
3 | 4877 { |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
4878 WindowData *blah = calloc(sizeof(WindowData), 1); |
3 | 4879 HWND tmp = WinCreateWindow(HWND_OBJECT, |
4880 WC_LISTBOX, | |
4881 NULL, | |
4882 WS_VISIBLE | LS_NOADJUSTPOS | | |
4883 (multi ? LS_MULTIPLESEL : 0), | |
4884 0,0,2000,1000, | |
4885 NULLHANDLE, | |
4886 HWND_TOP, | |
500
fe12a72bfddf
Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
499
diff
changeset
|
4887 id ? id : (GlobalID++), |
3 | 4888 NULL, |
4889 NULL); | |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4890 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
4891 WinSetWindowPtr(tmp, QWP_USER, blah); |
3 | 4892 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
|
4893 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |
3 | 4894 return tmp; |
4895 } | |
4896 | |
4897 /* | |
4898 * Sets the icon used for a given window. | |
4899 * Parameters: | |
4900 * handle: Handle to the window. | |
4901 * id: An ID to be used to specify the icon. | |
4902 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
4903 void API dw_window_set_icon(HWND handle, ULONG id) |
3 | 4904 { |
336
a2f72b5d5d0a
Minor change to dw_window_set_icon() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
328
diff
changeset
|
4905 HPOINTER icon = id < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id) : (HPOINTER)id; |
3 | 4906 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0); |
4907 } | |
4908 | |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4909 /* 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
|
4910 * 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
|
4911 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4912 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
|
4913 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4914 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
|
4915 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
|
4916 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
|
4917 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
|
4918 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
|
4919 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
|
4920 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
|
4921 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
|
4922 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
|
4923 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
|
4924 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
|
4925 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4926 /* 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
|
4927 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
|
4928 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
|
4929 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
|
4930 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
|
4931 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
|
4932 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4933 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
|
4934 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
|
4935 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4936 /* 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
|
4937 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
|
4938 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
|
4939 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4940 /* 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
|
4941 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
|
4942 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
|
4943 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4944 /* 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
|
4945 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
|
4946 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
|
4947 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4948 /* 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
|
4949 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
|
4950 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4951 /* 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
|
4952 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
|
4953 (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
|
4954 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4955 /* 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
|
4956 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
|
4957 /* 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
|
4958 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
|
4959 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
|
4960 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4961 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4962 /* 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
|
4963 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
|
4964 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4965 /* 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
|
4966 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
|
4967 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4968 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4969 /* 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
|
4970 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
|
4971 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4972 /* 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
|
4973 /* 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
|
4974 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
|
4975 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4976 *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
|
4977 *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
|
4978 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4979 else |
365
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4980 { |
eb86c22a9328
Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
363
diff
changeset
|
4981 *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
|
4982 *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
|
4983 } |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4984 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4985 /* 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
|
4986 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
|
4987 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4988 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
|
4989 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
|
4990 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4991 *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
|
4992 *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
|
4993 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4994 /* 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
|
4995 *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
|
4996 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
4997 /* 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
|
4998 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
|
4999 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5000 /* 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
|
5001 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
|
5002 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
|
5003 (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
|
5004 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5005 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
|
5006 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5007 /* 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
|
5008 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
|
5009 /* 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
|
5010 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
|
5011 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
|
5012 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5013 |
3 | 5014 /* |
5015 * Sets the bitmap used for a given static window. | |
5016 * Parameters: | |
5017 * 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
|
5018 * 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
|
5019 * (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
|
5020 * 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
|
5021 * 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
|
5022 * 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
|
5023 */ |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5024 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) |
3 | 5025 { |
5026 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
|
5027 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
|
5028 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5029 /* 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
|
5030 _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
|
5031 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5032 /* 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
|
5033 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
|
5034 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5035 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
|
5036 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5037 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
|
5038 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5039 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
|
5040 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5041 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
|
5042 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
|
5043 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
|
5044 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5045 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
|
5046 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5047 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5048 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
|
5049 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5050 /* 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
|
5051 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
|
5052 { |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5053 /* 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
|
5054 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
|
5055 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
|
5056 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5057 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5058 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5059 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
|
5060 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5061 |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5062 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
|
5063 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
|
5064 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
|
5065 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
|
5066 } |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5067 else |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5068 return; |
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
5069 |
3 | 5070 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f); |
5071 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
|
5072 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
|
5073 WinReleasePS(hps); |
235
69f2a59ec7d0
Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
230
diff
changeset
|
5074 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm); |
3 | 5075 } |
5076 | |
5077 /* | |
5078 * Sets the text used for a given window. | |
5079 * Parameters: | |
5080 * handle: Handle to the window. | |
5081 * text: The text associsated with a given window. | |
5082 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5083 void API dw_window_set_text(HWND handle, char *text) |
3 | 5084 { |
5085 WinSetWindowText(handle, text); | |
5086 } | |
5087 | |
5088 /* | |
5089 * Gets the text used for a given window. | |
5090 * Parameters: | |
5091 * handle: Handle to the window. | |
5092 * Returns: | |
5093 * text: The text associsated with a given window. | |
5094 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5095 char * API dw_window_get_text(HWND handle) |
3 | 5096 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5097 int len = WinQueryWindowTextLength(handle); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5098 char *tempbuf = calloc(1, len + 2); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5099 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5100 WinQueryWindowText(handle, len + 1, tempbuf); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5101 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
5102 return tempbuf; |
3 | 5103 } |
5104 | |
5105 /* | |
5106 * Disables given window (widget). | |
5107 * Parameters: | |
5108 * handle: Handle to the window. | |
5109 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5110 void API dw_window_disable(HWND handle) |
3 | 5111 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5112 char tmpbuf[100]; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5113 |
166
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
5114 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
|
5115 return; |
fb2987817924
Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
161
diff
changeset
|
5116 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5117 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
|
5118 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
|
5119 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5120 if(tmpbuf[0] == '#') |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5121 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5122 int val = atoi(&tmpbuf[1]); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5123 HWND hwnd; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5124 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5125 switch(val) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5126 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5127 case 2: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5128 case 6: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5129 case 10: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5130 case 32: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5131 case 7: |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5132 hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5133 _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
|
5134 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
|
5135 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
|
5136 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
|
5137 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5138 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
|
5139 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5140 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
|
5141 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
|
5142 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
|
5143 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
|
5144 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
|
5145 else |
f19440c0ff71
Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
366
diff
changeset
|
5146 _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
|
5147 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
|
5148 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
|
5149 return; |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5150 } |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5151 } |
3 | 5152 WinEnableWindow(handle, FALSE); |
5153 } | |
5154 | |
5155 /* | |
5156 * Enables given window (widget). | |
5157 * Parameters: | |
5158 * handle: Handle to the window. | |
5159 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5160 void API dw_window_enable(HWND handle) |
3 | 5161 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5162 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
|
5163 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
|
5164 HWND hwnd = _find_entryfield(handle); |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5165 |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5166 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
|
5167 if(hwnd) |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
5168 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
|
5169 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
|
5170 _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
|
5171 dw_signal_disconnect_by_data(handle, (void *)100); |
3 | 5172 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
|
5173 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
|
5174 WinInvalidateRect(handle, NULL, FALSE); |
3 | 5175 } |
5176 | |
5177 /* | |
5178 * Gets the child window handle with specified ID. | |
5179 * Parameters: | |
5180 * handle: Handle to the parent window. | |
5181 * id: Integer ID of the child. | |
5182 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5183 HWND API dw_window_from_id(HWND handle, int id) |
3 | 5184 { |
5185 HENUM henum; | |
5186 HWND child; | |
5187 char tmpbuf[100]; | |
5188 | |
5189 henum = WinBeginEnumWindows(handle); | |
5190 while((child = WinGetNextWindow(henum)) != NULLHANDLE) | |
5191 { | |
5192 int windowid = WinQueryWindowUShort(child, QWS_ID); | |
5193 HWND found; | |
5194 | |
5195 WinQueryClassName(child, 99, tmpbuf); | |
5196 | |
5197 /* 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
|
5198 if(strncmp(tmpbuf, "#1", 3)==0) |
3 | 5199 if((found = dw_window_from_id(child, id)) != NULLHANDLE) |
5200 return found; | |
5201 | |
5202 if(windowid && windowid == id) | |
5203 { | |
5204 WinEndEnumWindows(henum); | |
5205 return child; | |
5206 } | |
5207 } | |
5208 WinEndEnumWindows(henum); | |
5209 return NULLHANDLE; | |
5210 } | |
5211 | |
5212 /* | |
5213 * Pack windows (widgets) into a box from the end (or bottom). | |
5214 * Parameters: | |
5215 * box: Window handle of the box to be packed into. | |
5216 * item: Window handle of the item to be back. | |
5217 * width: Width in pixels of the item or -1 to be self determined. | |
5218 * height: Height in pixels of the item or -1 to be self determined. | |
5219 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
5220 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
5221 * pad: Number of pixels of padding around the item. | |
5222 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5223 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 5224 { |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5225 char *funcname = "dw_box_pack_end()"; |
3 | 5226 |
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
|
5227 /* |
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
|
5228 * 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
|
5229 * 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
|
5230 */ |
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
|
5231 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
|
5232 { |
526
d3ce0afa6cf5
Remove extraneous arguments to dw_messagebox()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
523
diff
changeset
|
5233 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!"); |
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
|
5234 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
|
5235 } |
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
|
5236 |
3 | 5237 if(WinWindowFromID(box, FID_CLIENT)) |
5238 { | |
5239 box = WinWindowFromID(box, FID_CLIENT); | |
5240 hsize = TRUE; | |
5241 vsize = TRUE; | |
5242 } | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5243 _dw_box_pack_end(box, item, width, height, hsize, vsize, pad, funcname); |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5244 } |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5245 |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5246 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5247 { |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5248 Box *thisbox = WinQueryWindowPtr(box, QWP_USER); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
5249 |
3 | 5250 if(thisbox) |
5251 { | |
5252 int z; | |
5253 Item *tmpitem, *thisitem = thisbox->items; | |
5254 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
|
5255 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box"); |
3 | 5256 |
5257 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
5258 | |
5259 for(z=0;z<thisbox->count;z++) | |
5260 { | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5261 tmpitem[z+1] = thisitem[z]; |
3 | 5262 } |
5263 | |
5264 WinQueryClassName(item, 99, tmpbuf); | |
5265 | |
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
|
5266 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
|
5267 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
|
5268 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
|
5269 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
|
5270 |
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
|
5271 if(strncmp(tmpbuf, "#1", 3)==0) |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5272 tmpitem[0].type = TYPEBOX; |
3 | 5273 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
|
5274 { |
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
|
5275 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
|
5276 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
|
5277 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
|
5278 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
|
5279 |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5280 tmpitem[0].type = TYPEITEM; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5281 } |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5282 |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5283 tmpitem[0].hwnd = item; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5284 tmpitem[0].origwidth = tmpitem[0].width = width; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5285 tmpitem[0].origheight = tmpitem[0].height = height; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5286 tmpitem[0].pad = pad; |
3 | 5287 if(hsize) |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5288 tmpitem[0].hsize = SIZEEXPAND; |
3 | 5289 else |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5290 tmpitem[0].hsize = SIZESTATIC; |
3 | 5291 |
5292 if(vsize) | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5293 tmpitem[0].vsize = SIZEEXPAND; |
3 | 5294 else |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5295 tmpitem[0].vsize = SIZESTATIC; |
3 | 5296 |
5297 thisbox->items = tmpitem; | |
5298 | |
5299 if(thisbox->count) | |
5300 free(thisitem); | |
5301 | |
5302 thisbox->count++; | |
5303 | |
5304 WinQueryClassName(item, 99, tmpbuf); | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
5305 /* 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
|
5306 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
|
5307 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
|
5308 WinSetParent(frame ? frame : item, box, FALSE); |
3 | 5309 } |
5310 } | |
5311 | |
5312 /* | |
5313 * Sets the size of a given window (widget). | |
5314 * Parameters: | |
5315 * handle: Window (widget) handle. | |
5316 * width: New width in pixels. | |
5317 * height: New height in pixels. | |
5318 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5319 void API dw_window_set_size(HWND handle, ULONG width, ULONG height) |
3 | 5320 { |
5321 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE); | |
5322 } | |
5323 | |
5324 /* | |
5325 * Returns the width of the screen. | |
5326 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5327 int API dw_screen_width(void) |
3 | 5328 { |
5329 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); | |
5330 } | |
5331 | |
5332 /* | |
5333 * Returns the height of the screen. | |
5334 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5335 int API dw_screen_height(void) |
3 | 5336 { |
5337 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); | |
5338 } | |
5339 | |
5340 /* This should return the current color depth */ | |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
5341 unsigned long API dw_color_depth_get(void) |
3 | 5342 { |
5343 HDC hdc = WinOpenWindowDC(HWND_DESKTOP); | |
5344 long colors; | |
5345 | |
5346 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors); | |
5347 DevCloseDC(hdc); | |
5348 return colors; | |
5349 } | |
5350 | |
5351 | |
5352 /* | |
5353 * Sets the position of a given window (widget). | |
5354 * Parameters: | |
5355 * handle: Window (widget) handle. | |
5356 * x: X location from the bottom left. | |
5357 * y: Y location from the bottom left. | |
5358 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5359 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y) |
3 | 5360 { |
5361 int myy = _get_frame_height(handle) - (y + _get_height(handle)); | |
5362 | |
5363 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE); | |
5364 } | |
5365 | |
5366 /* | |
5367 * Sets the position and size of a given window (widget). | |
5368 * Parameters: | |
5369 * handle: Window (widget) handle. | |
5370 * x: X location from the bottom left. | |
5371 * y: Y location from the bottom left. | |
5372 * width: Width of the widget. | |
5373 * height: Height of the widget. | |
5374 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5375 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height) |
3 | 5376 { |
5377 int myy = _get_frame_height(handle) - (y + height); | |
5378 | |
5379 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW); | |
5380 } | |
5381 | |
5382 /* | |
5383 * Gets the position and size of a given window (widget). | |
5384 * Parameters: | |
5385 * handle: Window (widget) handle. | |
5386 * x: X location from the bottom left. | |
5387 * y: Y location from the bottom left. | |
5388 * width: Width of the widget. | |
5389 * height: Height of the widget. | |
5390 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5391 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height) |
3 | 5392 { |
5393 SWP swp; | |
5394 WinQueryWindowPos(handle, &swp); | |
5395 if(x) | |
5396 *x = swp.x; | |
5397 if(y) | |
5398 *y = _get_frame_height(handle) - (swp.y + swp.cy); | |
5399 if(width) | |
5400 *width = swp.cx; | |
5401 if(height) | |
5402 *height = swp.cy; | |
5403 } | |
5404 | |
5405 /* | |
5406 * Sets the style of a given window (widget). | |
5407 * Parameters: | |
5408 * handle: Window (widget) handle. | |
5409 * width: New width in pixels. | |
5410 * height: New height in pixels. | |
5411 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5412 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask) |
3 | 5413 { |
5414 WinSetWindowBits(handle, QWL_STYLE, style, mask); | |
5415 } | |
5416 | |
5417 /* | |
5418 * Adds a new page to specified notebook. | |
5419 * Parameters: | |
5420 * handle: Window (widget) handle. | |
5421 * flags: Any additional page creation flags. | |
5422 * front: If TRUE page is added at the beginning. | |
5423 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5424 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front) |
3 | 5425 { |
5426 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
|
5427 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST)); |
3 | 5428 } |
5429 | |
5430 /* | |
5431 * Remove a page from a notebook. | |
5432 * Parameters: | |
5433 * handle: Handle to the notebook widget. | |
5434 * pageid: ID of the page to be destroyed. | |
5435 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5436 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid) |
3 | 5437 { |
5438 WinSendMsg(handle, BKM_DELETEPAGE, | |
5439 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE); | |
5440 } | |
5441 | |
5442 /* | |
5443 * Queries the currently visible page ID. | |
5444 * Parameters: | |
5445 * handle: Handle to the notebook widget. | |
5446 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5447 unsigned long API dw_notebook_page_get(HWND handle) |
346
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
5448 { |
81fae15885d7
Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
342
diff
changeset
|
5449 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR)); |
3 | 5450 } |
5451 | |
5452 /* | |
5453 * Sets the currently visibale page ID. | |
5454 * Parameters: | |
5455 * handle: Handle to the notebook widget. | |
5456 * pageid: ID of the page to be made visible. | |
5457 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5458 void API dw_notebook_page_set(HWND handle, unsigned int pageid) |
3 | 5459 { |
5460 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L); | |
5461 } | |
5462 | |
5463 /* | |
5464 * Sets the text on the specified notebook tab. | |
5465 * Parameters: | |
5466 * handle: Notebook handle. | |
5467 * pageid: Page ID of the tab to set. | |
5468 * text: Pointer to the text to set. | |
5469 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5470 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text) |
3 | 5471 { |
5472 WinSendMsg(handle, BKM_SETTABTEXT, | |
5473 MPFROMLONG(pageid), MPFROMP(text)); | |
5474 } | |
5475 | |
5476 /* | |
5477 * Sets the text on the specified notebook tab status area. | |
5478 * Parameters: | |
5479 * handle: Notebook handle. | |
5480 * pageid: Page ID of the tab to set. | |
5481 * text: Pointer to the text to set. | |
5482 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5483 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text) |
3 | 5484 { |
5485 WinSendMsg(handle, BKM_SETSTATUSLINETEXT, | |
5486 MPFROMLONG(pageid), MPFROMP(text)); | |
5487 } | |
5488 | |
5489 /* | |
5490 * Packs the specified box into the notebook page. | |
5491 * Parameters: | |
5492 * handle: Handle to the notebook to be packed. | |
5493 * pageid: Page ID in the notebook which is being packed. | |
5494 * page: Box handle to be packed. | |
5495 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5496 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) |
3 | 5497 { |
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
|
5498 HWND tmpbox = dw_box_new(DW_VERT, 0); |
3 | 5499 |
5500 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | |
5501 WinSubclassWindow(tmpbox, _wndproc); | |
5502 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND, | |
5503 MPFROMLONG(pageid), MPFROMHWND(tmpbox)); | |
5504 } | |
5505 | |
5506 /* | |
5507 * Appends the specified text to the listbox's (or combobox) entry list. | |
5508 * Parameters: | |
5509 * handle: Handle to the listbox to be appended to. | |
5510 * text: Text to append into listbox. | |
5511 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5512 void API dw_listbox_append(HWND handle, char *text) |
3 | 5513 { |
5514 WinSendMsg(handle, | |
5515 LM_INSERTITEM, | |
5516 MPFROMSHORT(LIT_END), | |
5517 MPFROMP(text)); | |
5518 } | |
5519 | |
5520 /* | |
5521 * Clears the listbox's (or combobox) list of all entries. | |
5522 * Parameters: | |
5523 * handle: Handle to the listbox to be cleared. | |
5524 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5525 void API dw_listbox_clear(HWND handle) |
3 | 5526 { |
5527 WinSendMsg(handle, | |
5528 LM_DELETEALL, 0L, 0L); | |
5529 } | |
5530 | |
5531 /* | |
5532 * Returns the listbox's item count. | |
5533 * Parameters: | |
5534 * handle: Handle to the listbox to be cleared. | |
5535 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5536 int API dw_listbox_count(HWND handle) |
3 | 5537 { |
5538 return (int)WinSendMsg(handle, | |
5539 LM_QUERYITEMCOUNT,0L, 0L); | |
5540 } | |
5541 | |
5542 /* | |
5543 * Sets the topmost item in the viewport. | |
5544 * Parameters: | |
5545 * handle: Handle to the listbox to be cleared. | |
5546 * top: Index to the top item. | |
5547 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5548 void API dw_listbox_set_top(HWND handle, int top) |
3 | 5549 { |
5550 WinSendMsg(handle, | |
5551 LM_SETTOPINDEX, | |
5552 MPFROMSHORT(top), | |
5553 0L); | |
5554 } | |
5555 | |
5556 /* | |
5557 * Copies the given index item's text into buffer. | |
5558 * Parameters: | |
5559 * handle: Handle to the listbox to be queried. | |
5560 * index: Index into the list to be queried. | |
5561 * buffer: Buffer where text will be copied. | |
5562 * length: Length of the buffer (including NULL). | |
5563 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5564 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length) |
3 | 5565 { |
5566 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer); | |
5567 } | |
5568 | |
5569 /* | |
5570 * Sets the text of a given listbox entry. | |
5571 * Parameters: | |
5572 * handle: Handle to the listbox to be queried. | |
5573 * index: Index into the list to be queried. | |
5574 * buffer: Buffer where text will be copied. | |
5575 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5576 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer) |
3 | 5577 { |
5578 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer); | |
5579 } | |
5580 | |
5581 /* | |
5582 * Returns the index to the item in the list currently selected. | |
5583 * Parameters: | |
5584 * handle: Handle to the listbox to be queried. | |
5585 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5586 unsigned int API dw_listbox_selected(HWND handle) |
3 | 5587 { |
5588 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
|
5589 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
|
5590 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
|
5591 0); |
3 | 5592 } |
5593 | |
5594 /* | |
5595 * Returns the index to the current selected item or -1 when done. | |
5596 * Parameters: | |
5597 * handle: Handle to the listbox to be queried. | |
5598 * where: Either the previous return or -1 to restart. | |
5599 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5600 int API dw_listbox_selected_multi(HWND handle, int where) |
3 | 5601 { |
5602 int place = where; | |
5603 | |
5604 if(where == -1) | |
5605 place = LIT_FIRST; | |
5606 | |
5607 place = (int)WinSendMsg(handle, | |
5608 LM_QUERYSELECTION, | |
5609 MPFROMSHORT(place),0L); | |
5610 if(place == LIT_NONE) | |
5611 return -1; | |
5612 return place; | |
5613 } | |
5614 | |
5615 /* | |
5616 * Sets the selection state of a given index. | |
5617 * Parameters: | |
5618 * handle: Handle to the listbox to be set. | |
5619 * index: Item index. | |
5620 * state: TRUE if selected FALSE if unselected. | |
5621 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5622 void API dw_listbox_select(HWND handle, int index, int state) |
3 | 5623 { |
34
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5624 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
|
5625 |
3 | 5626 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
|
5627 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5628 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
|
5629 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
5630 /* 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
|
5631 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
|
5632 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle); |
3 | 5633 } |
5634 | |
5635 /* | |
5636 * Deletes the item with given index from the list. | |
5637 * Parameters: | |
5638 * handle: Handle to the listbox to be set. | |
5639 * index: Item index. | |
5640 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5641 void API dw_listbox_delete(HWND handle, int index) |
3 | 5642 { |
5643 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0); | |
5644 } | |
5645 | |
5646 /* | |
5647 * Adds text to an MLE box and returns the current point. | |
5648 * Parameters: | |
5649 * handle: Handle to the MLE to be queried. | |
5650 * buffer: Text buffer to be imported. | |
5651 * startpoint: Point to start entering text. | |
5652 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5653 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint) |
3 | 5654 { |
5655 unsigned long point = startpoint; | |
5656 PBYTE mlebuf; | |
5657 | |
5658 /* Work around 64K limit */ | |
5659 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5660 { | |
5661 int amount, len = strlen(buffer), written = 0; | |
5662 | |
5663 while(written < len) | |
5664 { | |
5665 if((len - written) > 65535) | |
5666 amount = 65535; | |
5667 else | |
5668 amount = len - written; | |
5669 | |
5670 memcpy(mlebuf, &buffer[written], amount); | |
5671 mlebuf[amount] = '\0'; | |
5672 | |
5673 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1)); | |
5674 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1)); | |
5675 dw_mle_delete(handle, point, 1); | |
5676 | |
5677 written += amount; | |
5678 } | |
5679 DosFreeMem(mlebuf); | |
5680 } | |
5681 return point - 1; | |
5682 } | |
5683 | |
5684 /* | |
5685 * Grabs text from an MLE box. | |
5686 * Parameters: | |
5687 * handle: Handle to the MLE to be queried. | |
5688 * buffer: Text buffer to be exported. | |
5689 * startpoint: Point to start grabbing text. | |
5690 * length: Amount of text to be grabbed. | |
5691 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5692 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length) |
3 | 5693 { |
5694 PBYTE mlebuf; | |
5695 | |
5696 /* Work around 64K limit */ | |
5697 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE)) | |
5698 { | |
5699 int amount, copied, written = 0; | |
5700 | |
5701 while(written < length) | |
5702 { | |
5703 if((length - written) > 65535) | |
5704 amount = 65535; | |
5705 else | |
5706 amount = length - written; | |
5707 | |
5708 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount)); | |
5709 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount)); | |
5710 | |
5711 if(copied) | |
5712 { | |
5713 memcpy(&buffer[written], mlebuf, copied); | |
5714 | |
5715 written += copied; | |
5716 } | |
5717 else | |
5718 break; | |
5719 } | |
5720 DosFreeMem(mlebuf); | |
5721 } | |
5722 } | |
5723 | |
5724 /* | |
5725 * Obtains information about an MLE box. | |
5726 * Parameters: | |
5727 * handle: Handle to the MLE to be queried. | |
5728 * bytes: A pointer to a variable to return the total bytes. | |
5729 * lines: A pointer to a variable to return the number of lines. | |
5730 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5731 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines) |
3 | 5732 { |
5733 if(bytes) | |
5734 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0); | |
5735 if(lines) | |
5736 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0); | |
5737 } | |
5738 | |
5739 /* | |
5740 * Deletes text from an MLE box. | |
5741 * Parameters: | |
5742 * handle: Handle to the MLE to be deleted from. | |
5743 * startpoint: Point to start deleting text. | |
5744 * length: Amount of text to be deleted. | |
5745 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5746 void API dw_mle_delete(HWND handle, int startpoint, int length) |
3 | 5747 { |
5748 char *buf = malloc(length+1); | |
5749 int z, dellen = length; | |
5750 | |
5751 dw_mle_export(handle, buf, startpoint, length); | |
5752 | |
5753 for(z=0;z<length-1;z++) | |
5754 { | |
5755 if(strncmp(&buf[z], "\r\n", 2) == 0) | |
5756 dellen--; | |
5757 } | |
5758 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen)); | |
5759 free(buf); | |
5760 } | |
5761 | |
5762 /* | |
5763 * Clears all text from an MLE box. | |
5764 * Parameters: | |
5765 * handle: Handle to the MLE to be cleared. | |
5766 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5767 void API dw_mle_clear(HWND handle) |
3 | 5768 { |
5769 unsigned long bytes; | |
5770 | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5771 dw_mle_get_size(handle, &bytes, NULL); |
3 | 5772 |
5773 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes)); | |
5774 } | |
5775 | |
5776 /* | |
5777 * Sets the visible line of an MLE box. | |
5778 * Parameters: | |
5779 * handle: Handle to the MLE to be positioned. | |
5780 * line: Line to be visible. | |
5781 */ | |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
5782 void API dw_mle_set_visible(HWND handle, int line) |
3 | 5783 { |
153
a371875d5486
Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
152
diff
changeset
|
5784 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
|
5785 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt)); |
3 | 5786 } |
5787 | |
5788 /* | |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5789 * Sets the editablity of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5790 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5791 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5792 * 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
|
5793 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
5794 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
|
5795 { |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5796 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0); |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5797 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5798 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5799 /* |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5800 * Sets the word wrap state of an MLE box. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5801 * Parameters: |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5802 * handle: Handle to the MLE. |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5803 * 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
|
5804 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
5805 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
|
5806 { |
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
|
5807 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); |
7
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5808 } |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5809 |
005fa766e8c2
Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
5810 /* |
3 | 5811 * Sets the current cursor position of an MLE box. |
5812 * Parameters: | |
5813 * handle: Handle to the MLE to be positioned. | |
5814 * point: Point to position cursor. | |
5815 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5816 void API dw_mle_set_cursor(HWND handle, int point) |
3 | 5817 { |
5818 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point)); | |
5819 } | |
5820 | |
5821 /* | |
5822 * Finds text in an MLE box. | |
5823 * Parameters: | |
5824 * handle: Handle to the MLE to be cleared. | |
5825 * text: Text to search for. | |
5826 * point: Start point of search. | |
5827 * flags: Search specific flags. | |
5828 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5829 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags) |
3 | 5830 { |
5831 MLE_SEARCHDATA msd; | |
5832 | |
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
|
5833 /* 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
|
5834 * 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
|
5835 */ |
3 | 5836 msd.cb = sizeof(msd); |
5837 msd.pchFind = text; | |
5838 msd.pchReplace = NULL; | |
5839 msd.cchFind = strlen(text); | |
5840 msd.cchReplace = 0; | |
5841 msd.iptStart = point; | |
5842 msd.iptStop = -1; | |
5843 | |
5844 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd)) | |
5845 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0); | |
5846 return 0; | |
5847 } | |
5848 | |
5849 /* | |
5850 * Stops redrawing of an MLE box. | |
5851 * Parameters: | |
5852 * handle: Handle to the MLE to freeze. | |
5853 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5854 void API dw_mle_freeze(HWND handle) |
3 | 5855 { |
5856 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0); | |
5857 } | |
5858 | |
5859 /* | |
5860 * Resumes redrawing of an MLE box. | |
5861 * Parameters: | |
5862 * handle: Handle to the MLE to thaw. | |
5863 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5864 void API dw_mle_thaw(HWND handle) |
3 | 5865 { |
5866 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0); | |
5867 } | |
5868 | |
5869 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5870 * Returns the range of the percent bar. |
3 | 5871 * 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
|
5872 * handle: Handle to the percent bar to be queried. |
3 | 5873 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5874 unsigned int API dw_percent_get_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
|
5875 { |
62
2be5174bdb5d
Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
61
diff
changeset
|
5876 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0)); |
3 | 5877 } |
5878 | |
5879 /* | |
33
72675de7d229
Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
31
diff
changeset
|
5880 * Sets the percent bar position. |
3 | 5881 * 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
|
5882 * 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
|
5883 * position: Position of the percent bar withing the range. |
3 | 5884 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5885 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
|
5886 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5887 _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
|
5888 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position); |
3 | 5889 } |
5890 | |
5891 /* | |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5892 * 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
|
5893 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5894 * 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
|
5895 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5896 unsigned int API dw_slider_get_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
|
5897 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5898 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
|
5899 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5900 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5901 /* |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5902 * 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
|
5903 * Parameters: |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5904 * 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
|
5905 * 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
|
5906 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5907 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
|
5908 { |
94
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
5909 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
|
5910 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
|
5911 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5912 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
5913 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5914 * 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
|
5915 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5916 * 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
|
5917 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5918 unsigned int API dw_scrollbar_get_pos(HWND handle) |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5919 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5920 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
|
5921 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5922 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5923 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5924 * 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
|
5925 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5926 * 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
|
5927 * 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
|
5928 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5929 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
|
5930 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5931 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
|
5932 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
|
5933 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5934 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5935 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5936 * 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
|
5937 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5938 * 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
|
5939 * 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
|
5940 * 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
|
5941 */ |
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
|
5942 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
|
5943 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5944 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
|
5945 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
|
5946 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
|
5947 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
|
5948 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5949 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
5950 /* |
3 | 5951 * Sets the spinbutton value. |
5952 * Parameters: | |
5953 * handle: Handle to the spinbutton to be set. | |
5954 * position: Current value of the spinbutton. | |
5955 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5956 void API dw_spinbutton_set_pos(HWND handle, long position) |
3 | 5957 { |
5958 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L); | |
5959 } | |
5960 | |
5961 /* | |
5962 * Sets the spinbutton limits. | |
5963 * Parameters: | |
5964 * handle: Handle to the spinbutton to be set. | |
5965 * upper: Upper limit. | |
5966 * lower: Lower limit. | |
5967 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5968 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower) |
3 | 5969 { |
5970 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower)); | |
5971 } | |
5972 | |
5973 /* | |
5974 * Sets the entryfield character limit. | |
5975 * Parameters: | |
5976 * handle: Handle to the spinbutton to be set. | |
5977 * limit: Number of characters the entryfield will take. | |
5978 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
5979 void API dw_entryfield_set_limit(HWND handle, ULONG limit) |
3 | 5980 { |
5981 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0); | |
5982 } | |
5983 | |
5984 | |
5985 /* | |
5986 * Returns the current value of the spinbutton. | |
5987 * Parameters: | |
5988 * handle: Handle to the spinbutton to be queried. | |
5989 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
5990 long API dw_spinbutton_get_pos(HWND handle) |
3 | 5991 { |
5992 long tmpval = 0L; | |
5993 | |
5994 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L); | |
5995 return tmpval; | |
5996 } | |
5997 | |
5998 /* | |
5999 * Returns the state of the checkbox. | |
6000 * Parameters: | |
6001 * handle: Handle to the checkbox to be queried. | |
6002 */ | |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6003 int API dw_checkbox_get(HWND handle) |
3 | 6004 { |
6005 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0); | |
6006 } | |
6007 | |
6008 /* | |
6009 * Sets the state of the checkbox. | |
6010 * Parameters: | |
6011 * handle: Handle to the checkbox to be queried. | |
6012 * value: TRUE for checked, FALSE for unchecked. | |
6013 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6014 void API dw_checkbox_set(HWND handle, int value) |
3 | 6015 { |
6016 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0); | |
6017 } | |
6018 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6019 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6020 * 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
|
6021 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6022 * 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
|
6023 * 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
|
6024 * 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
|
6025 * 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
|
6026 * 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
|
6027 * 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
|
6028 */ |
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
|
6029 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
|
6030 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6031 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
|
6032 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
|
6033 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
|
6034 |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6035 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
|
6036 item = (HTREEITEM)CMA_FIRST; |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6037 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6038 /* 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
|
6039 * 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
|
6040 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6041 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6042 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
|
6043 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6044 /* 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
|
6045 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
6046 if((pci = (PCNRITEM)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1), 0)) == 0) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
6047 return 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
|
6048 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6049 /* 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
|
6050 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6051 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
|
6052 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
|
6053 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
|
6054 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6055 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
|
6056 pci->user = itemdata; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6057 pci->parent = parent; |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6058 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6059 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
|
6060 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6061 ri.cb = sizeof(RECORDINSERT); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6062 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
|
6063 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
|
6064 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
|
6065 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
|
6066 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6067 /* 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
|
6068 * 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
|
6069 */ |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6070 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
|
6071 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6072 /* 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
|
6073 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
|
6074 |
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
|
6075 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
|
6076 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6077 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6078 /* |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6079 * 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
|
6080 * Parameters: |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6081 * 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
|
6082 * title: The text title of the entry. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6083 * icon: Handle to coresponding icon. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6084 * parent: Parent handle or 0 if root. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6085 * itemdata: Item specific data. |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6086 */ |
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
|
6087 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
|
6088 { |
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
|
6089 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
|
6090 } |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6091 |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6092 /* |
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
|
6093 * 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
|
6094 * 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
|
6095 * 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
|
6096 * 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
|
6097 * 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
|
6098 * 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
|
6099 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6100 void API dw_tree_item_change(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
|
6101 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6102 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
|
6103 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6104 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
|
6105 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
|
6106 |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6107 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
|
6108 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
|
6109 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6110 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
|
6111 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
|
6112 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6113 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
|
6114 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6115 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
|
6116 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6117 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6118 /* |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6119 * Gets the text an item in a tree window (widget). |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6120 * Parameters: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6121 * handle: Handle to the tree containing the item. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6122 * item: Handle of the item to be modified. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6123 */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6124 char * API dw_tree_get_title(HWND handle, HTREEITEM item) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6125 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6126 PCNRITEM pci = (PCNRITEM)item; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6127 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6128 handle = handle; /* keep compiler happy */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6129 if(pci) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6130 return pci->rc.pszIcon; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6131 return NULL; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6132 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6133 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6134 /* |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6135 * Gets the text an item in a tree window (widget). |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6136 * Parameters: |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6137 * handle: Handle to the tree containing the item. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6138 * item: Handle of the item to be modified. |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6139 */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6140 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6141 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6142 PCNRITEM pci = (PCNRITEM)item; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6143 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6144 handle = handle; /* keep compiler happy */ |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6145 if(pci) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6146 return pci->parent; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6147 return (HTREEITEM)0; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6148 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6149 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6150 /* |
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
|
6151 * 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
|
6152 * 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
|
6153 * 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
|
6154 * 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
|
6155 * 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
|
6156 */ |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
6157 void API dw_tree_item_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
|
6158 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6159 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
|
6160 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6161 handle = handle; /* keep compiler happy */ |
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
|
6162 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
|
6163 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
|
6164 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6165 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
|
6166 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6167 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6168 /* |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6169 * 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
|
6170 * Parameters: |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6171 * 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
|
6172 * 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
|
6173 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6174 void * API dw_tree_item_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
|
6175 { |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6176 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
|
6177 |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6178 handle = handle; /* keep compiler happy */ |
317
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6179 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
|
6180 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
|
6181 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
|
6182 } |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6183 |
83edbd751da9
Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
315
diff
changeset
|
6184 /* |
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
|
6185 * 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
|
6186 * 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
|
6187 * 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
|
6188 * 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
|
6189 */ |
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
|
6190 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
|
6191 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6192 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
|
6193 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6194 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
|
6195 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6196 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
|
6197 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
|
6198 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
|
6199 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6200 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
|
6201 lastitem = 0; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6202 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
|
6203 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6204 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6205 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6206 * Removes all nodes from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6207 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6208 * 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
|
6209 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6210 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
|
6211 { |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6212 dw_container_clear(handle, TRUE); |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6213 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6214 |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6215 /* |
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
|
6216 * 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
|
6217 * 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
|
6218 * 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
|
6219 * 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
|
6220 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6221 void API dw_tree_item_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
|
6222 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6223 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
|
6224 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6225 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6226 /* |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6227 * 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
|
6228 * 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
|
6229 * 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
|
6230 * 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
|
6231 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6232 void API dw_tree_item_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
|
6233 { |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6234 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
|
6235 } |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6236 |
c4e1139d9872
Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
52
diff
changeset
|
6237 /* |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6238 * Removes a node from a tree. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6239 * Parameters: |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6240 * 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
|
6241 * item: Handle to node to be deleted. |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6242 */ |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
6243 void API dw_tree_item_delete(HWND handle, HTREEITEM item) |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6244 { |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6245 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
|
6246 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6247 if(!item) |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6248 return; |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6249 |
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6250 if(pci->rc.pszIcon) |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6251 { |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6252 free(pci->rc.pszIcon); |
60
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6253 pci->rc.pszIcon = 0; |
61869769c050
Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
58
diff
changeset
|
6254 } |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
6255 |
30
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6256 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
|
6257 } |
b1d7e8a28dfa
Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
6258 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6259 /* 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
|
6260 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
|
6261 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
|
6262 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
|
6263 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
|
6264 } ContainerInfo; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6265 |
3 | 6266 /* |
6267 * Sets up the container columns. | |
6268 * Parameters: | |
6269 * handle: Handle to the container to be configured. | |
6270 * flags: An array of unsigned longs with column flags. | |
6271 * titles: An array of strings with column text titles. | |
6272 * count: The number of columns (this should match the arrays). | |
6273 * separator: The column number that contains the main separator. | |
6274 * (this item may only be used in OS/2) | |
6275 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6276 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator) |
3 | 6277 { |
6278 PFIELDINFO details, first, left = NULL; | |
6279 FIELDINFOINSERT detin; | |
6280 CNRINFO cnri; | |
6281 int z; | |
6282 ULONG size = sizeof(RECORDCORE); | |
6283 ULONG *offStruct = malloc(count * sizeof(ULONG)); | |
6284 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
|
6285 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
|
6286 ULONG *oldflags = blah ? blah->data : 0; |
3 | 6287 |
6288 if(!offStruct || !tempflags) | |
6289 return FALSE; | |
6290 | |
6291 memcpy(tempflags, flags, count * sizeof(ULONG)); | |
6292 tempflags[count] = 0; | |
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 blah->data = tempflags; |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
6295 blah->flags = separator; |
3 | 6296 |
6297 if(oldflags) | |
6298 free(oldflags); | |
6299 | |
6300 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL) | |
6301 { | |
6302 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE)); | |
6303 } | |
6304 | |
6305 /* Figure out the offsets to the items in the struct */ | |
6306 for(z=0;z<count;z++) | |
6307 { | |
6308 offStruct[z] = size; | |
6309 if(flags[z] & DW_CFA_BITMAPORICON) | |
6310 size += sizeof(HPOINTER); | |
6311 else if(flags[z] & DW_CFA_STRING) | |
6312 size += sizeof(char *); | |
6313 else if(flags[z] & DW_CFA_ULONG) | |
6314 size += sizeof(ULONG); | |
6315 else if(flags[z] & DW_CFA_DATE) | |
6316 size += sizeof(CDATE); | |
6317 else if(flags[z] & DW_CFA_TIME) | |
6318 size += sizeof(CTIME); | |
6319 } | |
6320 | |
6321 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L); | |
6322 | |
6323 if(!first) | |
6324 { | |
6325 free(offStruct); | |
6326 return FALSE; | |
6327 } | |
6328 | |
6329 for(z=0;z<count;z++) | |
6330 { | |
6331 if(z==separator-1) | |
6332 left=details; | |
6333 details->cb = sizeof(FIELDINFO); | |
6334 details->flData = flags[z]; | |
6335 details->flTitle = CFA_FITITLEREADONLY; | |
6336 details->pTitleData = titles[z]; | |
6337 details->offStruct = offStruct[z]; | |
6338 details = details->pNextFieldInfo; | |
6339 } | |
6340 | |
6341 detin.cb = sizeof(FIELDINFOINSERT); | |
6342 detin.fInvalidateFieldInfo = FALSE; | |
6343 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST; | |
6344 detin.cFieldInfoInsert = (ULONG)count; | |
6345 | |
6346 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin)); | |
6347 | |
18
f1002d51d959
Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
16
diff
changeset
|
6348 if(count > separator && separator > 0) |
3 | 6349 { |
6350 cnri.cb = sizeof(CNRINFO); | |
6351 cnri.pFieldInfoLast = left; | |
6352 cnri.xVertSplitbar = 150; | |
6353 | |
6354 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR)); | |
6355 } | |
6356 | |
310
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6357 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
|
6358 cnri.slBitmapOrIcon.cx = 16; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6359 cnri.slBitmapOrIcon.cy = 16; |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6360 |
77105fe19c1f
Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
307
diff
changeset
|
6361 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
|
6362 |
3 | 6363 free(offStruct); |
6364 return TRUE; | |
6365 } | |
6366 | |
6367 /* | |
6368 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | |
6369 * Parameters: | |
6370 * handle: Handle to the container to be configured. | |
6371 * flags: An array of unsigned longs with column flags. | |
6372 * titles: An array of strings with column text titles. | |
6373 * count: The number of columns (this should match the arrays). | |
6374 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6375 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
3 | 6376 { |
6377 char **newtitles = malloc(sizeof(char *) * (count + 2)); | |
6378 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); | |
6379 | |
6380 newtitles[0] = "Icon"; | |
6381 newtitles[1] = "Filename"; | |
6382 | |
6383 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR; | |
6384 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | |
6385 | |
6386 memcpy(&newtitles[2], titles, sizeof(char *) * count); | |
6387 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); | |
6388 | |
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
|
6389 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0); |
3 | 6390 |
6391 free(newtitles); | |
6392 free(newflags); | |
6393 return TRUE; | |
6394 } | |
6395 | |
6396 /* | |
6397 * Obtains an icon from a module (or header in GTK). | |
6398 * Parameters: | |
6399 * module: Handle to module (DLL) in OS/2 and Windows. | |
6400 * id: A unsigned long id int the resources on OS/2 and | |
6401 * Windows, on GTK this is converted to a pointer | |
6402 * to an embedded XPM. | |
6403 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6404 unsigned long API dw_icon_load(unsigned long module, unsigned long id) |
3 | 6405 { |
6406 return WinLoadPointer(HWND_DESKTOP,module,id); | |
6407 } | |
6408 | |
6409 /* | |
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
|
6410 * 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
|
6411 * 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
|
6412 * 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
|
6413 * 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
|
6414 * (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
|
6415 */ |
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
|
6416 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
|
6417 { |
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
|
6418 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
|
6419 |
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
|
6420 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
|
6421 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
|
6422 |
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
|
6423 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
|
6424 |
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
|
6425 /* 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
|
6426 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
|
6427 { |
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
|
6428 /* 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
|
6429 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
|
6430 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
|
6431 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
|
6432 } |
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
|
6433 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
|
6434 } |
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
|
6435 |
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
|
6436 /* |
3 | 6437 * Frees a loaded resource in OS/2 and Windows. |
6438 * Parameters: | |
6439 * handle: Handle to icon returned by dw_icon_load(). | |
6440 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6441 void API dw_icon_free(unsigned long handle) |
3 | 6442 { |
6443 WinDestroyPointer(handle); | |
6444 } | |
6445 | |
6446 /* | |
6447 * Allocates memory used to populate a container. | |
6448 * Parameters: | |
6449 * handle: Handle to the container window (widget). | |
6450 * rowcount: The number of items to be populated. | |
6451 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6452 void * API dw_container_alloc(HWND handle, int rowcount) |
3 | 6453 { |
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
|
6454 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
|
6455 ULONG *flags = wd ? wd->data : 0; |
3 | 6456 int z, size = 0, totalsize, count = 0; |
6457 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
|
6458 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
|
6459 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
|
6460 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
6461 if(!flags || rowcount < 1) |
3 | 6462 return NULL; |
6463 | |
6464 while(flags[count]) | |
6465 count++; | |
6466 | |
6467 /* Figure out the offsets to the items in the struct */ | |
6468 for(z=0;z<count;z++) | |
6469 { | |
6470 if(flags[z] & DW_CFA_BITMAPORICON) | |
6471 size += sizeof(HPOINTER); | |
6472 else if(flags[z] & DW_CFA_STRING) | |
6473 size += sizeof(char *); | |
6474 else if(flags[z] & DW_CFA_ULONG) | |
6475 size += sizeof(ULONG); | |
6476 else if(flags[z] & DW_CFA_DATE) | |
6477 size += sizeof(CDATE); | |
6478 else if(flags[z] & DW_CFA_TIME) | |
6479 size += sizeof(CTIME); | |
6480 } | |
6481 | |
6482 totalsize = size + sizeof(RECORDCORE); | |
6483 | |
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
|
6484 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
|
6485 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6486 if(!(blah = (void *)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount), 0))) |
3 | 6487 return NULL; |
6488 | |
6489 temp = (PRECORDCORE)blah; | |
6490 | |
6491 for(z=0;z<rowcount;z++) | |
6492 { | |
6493 temp->cb = totalsize; | |
6494 temp = temp->preccNextRecord; | |
6495 } | |
6496 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6497 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
|
6498 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6499 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
|
6500 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
|
6501 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
|
6502 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6503 return (void *)ci; |
3 | 6504 } |
6505 | |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6506 /* 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
|
6507 void _dw_container_set_item(HWND handle, PRECORDCORE temp, int column, int row, void *data) |
3 | 6508 { |
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
|
6509 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
|
6510 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
|
6511 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
|
6512 CNRINFO cnr; |
3 | 6513 void *dest; |
6514 | |
6515 if(!flags) | |
6516 return; | |
6517 | |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6518 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
|
6519 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6520 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6521 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
|
6522 |
3 | 6523 /* Figure out the offsets to the items in the struct */ |
6524 for(z=0;z<column;z++) | |
6525 { | |
6526 if(flags[z] & DW_CFA_BITMAPORICON) | |
6527 size += sizeof(HPOINTER); | |
6528 else if(flags[z] & DW_CFA_STRING) | |
6529 size += sizeof(char *); | |
6530 else if(flags[z] & DW_CFA_ULONG) | |
6531 size += sizeof(ULONG); | |
6532 else if(flags[z] & DW_CFA_DATE) | |
6533 size += sizeof(CDATE); | |
6534 else if(flags[z] & DW_CFA_TIME) | |
6535 size += sizeof(CTIME); | |
6536 } | |
6537 | |
6538 totalsize = size + sizeof(RECORDCORE); | |
6539 | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6540 for(z=0;z<(row-currentcount);z++) |
3 | 6541 temp = temp->preccNextRecord; |
6542 | |
6543 dest = (void *)(((ULONG)temp)+((ULONG)totalsize)); | |
6544 | |
6545 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
|
6546 memcpy(dest, data, sizeof(HPOINTER)); |
3 | 6547 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
|
6548 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6549 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
|
6550 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6551 if(*str) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6552 free(*str); |
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 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
|
6555 *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
|
6556 else |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6557 *str = NULL; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6558 } |
3 | 6559 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
|
6560 memcpy(dest, data, sizeof(ULONG)); |
3 | 6561 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
|
6562 memcpy(dest, data, sizeof(CDATE)); |
3 | 6563 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
|
6564 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
|
6565 } |
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
|
6566 |
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
|
6567 /* 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
|
6568 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
|
6569 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6570 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
|
6571 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
|
6572 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
|
6573 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6574 if(!flags) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6575 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6576 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6577 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
|
6578 count++; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6579 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6580 /* 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
|
6581 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
|
6582 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6583 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
|
6584 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
|
6585 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
|
6586 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6587 char **str; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6588 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6589 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
|
6590 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6591 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
|
6592 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6593 if(*str) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6594 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6595 free(*str); |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6596 *str = NULL; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6597 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6598 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
|
6599 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6600 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
|
6601 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
|
6602 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
|
6603 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
|
6604 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
|
6605 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
|
6606 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6607 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6608 |
3 | 6609 /* |
6610 * Sets an item in specified row and column to the given data. | |
6611 * Parameters: | |
6612 * handle: Handle to the container window (widget). | |
6613 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6614 * column: Zero based column of data being set. | |
6615 * row: Zero based row of data being set. | |
6616 * data: Pointer to the data to be added. | |
6617 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6618 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
|
6619 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6620 ContainerInfo *ci = (ContainerInfo *)pointer; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6621 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6622 if(!ci) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6623 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6624 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6625 _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
|
6626 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6627 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6628 /* |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6629 * 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
|
6630 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6631 * 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
|
6632 * 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
|
6633 * 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
|
6634 * 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
|
6635 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6636 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
|
6637 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6638 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
|
6639 int count = 0; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6640 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6641 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6642 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6643 if(count == row) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6644 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6645 _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
|
6646 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
|
6647 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6648 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6649 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
|
6650 count++; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6651 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6652 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6653 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6654 /* |
503
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6655 * Changes an existing item in specified row and column to the given data. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6656 * Parameters: |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6657 * handle: Handle to the container window (widget). |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6658 * column: Zero based column of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6659 * row: Zero based row of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6660 * data: Pointer to the data to be added. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6661 */ |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6662 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data) |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6663 { |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6664 dw_container_change_item(handle, column + 2, row, data); |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6665 } |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6666 |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6667 /* |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6668 * Changes an item in specified row and column to the given data. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6669 * Parameters: |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6670 * handle: Handle to the container window (widget). |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6671 * pointer: Pointer to the allocated memory in dw_container_alloc(). |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6672 * column: Zero based column of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6673 * row: Zero based row of data being set. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6674 * data: Pointer to the data to be added. |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6675 */ |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6676 void API dw_filesystem_change_file(HWND handle, int row, char *filename, unsigned long icon) |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6677 { |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6678 dw_container_change_item(handle, 0, row, (void *)&icon); |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6679 dw_container_change_item(handle, 1, row, (void *)&filename); |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6680 } |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6681 |
f3ed8dda02f8
Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
500
diff
changeset
|
6682 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6683 * 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
|
6684 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
6685 * 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
|
6686 * 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
|
6687 * 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
|
6688 * 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
|
6689 * 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
|
6690 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6691 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) |
3 | 6692 { |
6693 dw_container_set_item(handle, pointer, 0, row, (void *)&icon); | |
6694 dw_container_set_item(handle, pointer, 1, row, (void *)&filename); | |
6695 } | |
6696 | |
6697 /* | |
6698 * Sets an item in specified row and column to the given data. | |
6699 * Parameters: | |
6700 * handle: Handle to the container window (widget). | |
6701 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6702 * column: Zero based column of data being set. | |
6703 * row: Zero based row of data being set. | |
6704 * data: Pointer to the data to be added. | |
6705 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6706 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data) |
3 | 6707 { |
6708 dw_container_set_item(handle, pointer, column + 2, row, data); | |
6709 } | |
6710 | |
6711 /* | |
508
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6712 * Gets column type for a container column |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6713 * Parameters: |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6714 * handle: Handle to the container window (widget). |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6715 * column: Zero based column. |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6716 */ |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6717 int API dw_container_get_column_type(HWND handle, int column) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6718 { |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6719 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER); |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6720 ULONG *flags = blah ? blah->data : 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6721 int rc; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6722 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6723 if(!flags) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6724 return 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6725 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6726 if(flags[column] & DW_CFA_BITMAPORICON) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6727 rc = DW_CFA_BITMAPORICON; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6728 else if(flags[column] & DW_CFA_STRING) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6729 rc = DW_CFA_STRING; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6730 else if(flags[column] & DW_CFA_ULONG) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6731 rc = DW_CFA_ULONG; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6732 else if(flags[column] & DW_CFA_DATE) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6733 rc = DW_CFA_DATE; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6734 else if(flags[column] & DW_CFA_TIME) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6735 rc = DW_CFA_TIME; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6736 else |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6737 rc = 0; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6738 return rc; |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6739 } |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6740 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6741 /* |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6742 * Gets column type for a filesystem container column |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6743 * Parameters: |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6744 * handle: Handle to the container window (widget). |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6745 * column: Zero based column. |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6746 */ |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6747 int API dw_filesystem_get_column_type(HWND handle, int column) |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6748 { |
545
11e3d5e3543c
COlumn offsets for filesystem containers in OS/2 is 2; not 1.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
543
diff
changeset
|
6749 return dw_container_get_column_type( handle, column + 2 ); |
508
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6750 } |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6751 |
078a40ba2e41
Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
507
diff
changeset
|
6752 /* |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6753 * 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
|
6754 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6755 * 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
|
6756 * 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
|
6757 * 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
|
6758 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6759 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
|
6760 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6761 handle = handle; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6762 column = column; /* keep compiler happy */ |
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6763 width = width; /* keep compiler happy */ |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6764 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6765 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6766 /* |
3 | 6767 * Sets the title of a row in the container. |
6768 * Parameters: | |
6769 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6770 * row: Zero based row of data being set. | |
6771 * title: String title of the item. | |
6772 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6773 void API dw_container_set_row_title(void *pointer, int row, char *title) |
3 | 6774 { |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6775 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
|
6776 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
|
6777 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
|
6778 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
|
6779 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6780 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6781 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6782 |
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
|
6783 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
|
6784 |
72
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6785 z = 0; |
ab77a22a2a36
Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
70
diff
changeset
|
6786 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6787 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
|
6788 return; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6789 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6790 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
|
6791 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6792 for(z=0;z<(row-currentcount);z++) |
3 | 6793 temp = temp->preccNextRecord; |
6794 | |
6795 temp->pszIcon = title; | |
6796 temp->pszName = title; | |
6797 temp->pszText = title; | |
6798 } | |
6799 | |
6800 /* | |
6801 * Sets the title of a row in the container. | |
6802 * Parameters: | |
6803 * handle: Handle to the container window (widget). | |
6804 * pointer: Pointer to the allocated memory in dw_container_alloc(). | |
6805 * rowcount: The number of rows to be inserted. | |
6806 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6807 void API dw_container_insert(HWND handle, void *pointer, int rowcount) |
3 | 6808 { |
6809 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
|
6810 ContainerInfo *ci = (ContainerInfo *)pointer; |
3 | 6811 |
23
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6812 if(!ci) |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6813 return; |
2932f9d2c7d5
New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
22
diff
changeset
|
6814 |
3 | 6815 recin.cb = sizeof(RECORDINSERT); |
6816 recin.pRecordOrder = (PRECORDCORE)CMA_END; | |
6817 recin.pRecordParent = NULL; | |
6818 recin.zOrder = CMA_TOP; | |
6819 recin.fInvalidateRecord = TRUE; | |
6820 recin.cRecordsInsert = rowcount; | |
6821 | |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6822 _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
|
6823 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6824 free(ci); |
3 | 6825 } |
6826 | |
6827 /* | |
6828 * Removes all rows from a container. | |
6829 * Parameters: | |
6830 * 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
|
6831 * 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
|
6832 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6833 void API dw_container_clear(HWND handle, int redraw) |
3 | 6834 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6835 PCNRITEM pCore; |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6836 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
|
6837 |
315
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
6838 if(hwndEmph == handle) |
89eac0990c67
Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
314
diff
changeset
|
6839 _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
|
6840 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6841 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
|
6842 |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6843 while(pCore) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6844 { |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6845 if(container) |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6846 _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
|
6847 else |
290
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6848 { |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6849 /* Free icon text */ |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6850 if(pCore->rc.pszIcon) |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6851 { |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6852 free(pCore->rc.pszIcon); |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6853 pCore->rc.pszIcon = 0; |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6854 } |
8ea5b2c35bfe
Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
289
diff
changeset
|
6855 } |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
6856 pCore = (PCNRITEM)pCore->rc.preccNextRecord;/*WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));*/ |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6857 } |
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6858 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE), -1); |
3 | 6859 } |
6860 | |
6861 /* | |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6862 * 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
|
6863 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6864 * 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
|
6865 * 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
|
6866 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6867 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
|
6868 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6869 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
|
6870 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
|
6871 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6872 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
|
6873 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6874 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
|
6875 { |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6876 _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
|
6877 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
|
6878 current++; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6879 } |
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
|
6880 |
326
1c961a4d0f43
Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
317
diff
changeset
|
6881 _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
|
6882 |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6883 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
|
6884 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6885 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6886 /* |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6887 * 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
|
6888 * Parameters: |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6889 * 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
|
6890 * 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
|
6891 * 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
|
6892 * 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
|
6893 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6894 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
|
6895 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
6896 rows = rows; /* keep compiler happy */ |
22
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6897 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
|
6898 { |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6899 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
|
6900 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
|
6901 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6902 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
|
6903 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
|
6904 break; |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6905 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6906 } |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6907 |
6a246b3bb14f
Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
21
diff
changeset
|
6908 /* |
3 | 6909 * Starts a new query of a container. |
6910 * Parameters: | |
6911 * handle: Handle to the window (widget) to be queried. | |
6912 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6913 * return items that are currently selected. Otherwise | |
6914 * it will return all records in the container. | |
6915 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6916 char * API dw_container_query_start(HWND handle, unsigned long flags) |
3 | 6917 { |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6918 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6919 |
3 | 6920 if(pCore) |
6921 { | |
6922 if(flags) | |
6923 { | |
6924 while(pCore) | |
6925 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6926 if(pCore->flRecordAttr & flags) |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6927 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6928 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6929 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6930 } |
3 | 6931 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
6932 } | |
6933 } | |
6934 else | |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6935 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6936 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6937 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6938 } |
3 | 6939 } |
6940 return NULL; | |
6941 } | |
6942 | |
6943 /* | |
6944 * Continues an existing query of a container. | |
6945 * Parameters: | |
6946 * handle: Handle to the window (widget) to be queried. | |
6947 * flags: If this parameter is DW_CRA_SELECTED it will only | |
6948 * return items that are currently selected. Otherwise | |
6949 * it will return all records in the container. | |
6950 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6951 char * API dw_container_query_next(HWND handle, unsigned long flags) |
3 | 6952 { |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6953 PRECORDCORE pCore = (PRECORDCORE)dw_window_get_data(handle, "_dw_pcore"); |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6954 |
3 | 6955 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6956 |
3 | 6957 if(pCore) |
6958 { | |
6959 if(flags) | |
6960 { | |
6961 while(pCore) | |
6962 { | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6963 if(pCore->flRecordAttr & flags) |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6964 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6965 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6966 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6967 } |
3 | 6968 |
6969 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | |
6970 } | |
6971 } | |
6972 else | |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6973 { |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6974 dw_window_set_data(handle, "_dw_pcore", (void *)pCore); |
3 | 6975 return pCore->pszIcon; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6976 } |
3 | 6977 } |
6978 return NULL; | |
6979 } | |
6980 | |
6981 /* | |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6982 * 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
|
6983 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6984 * 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
|
6985 * 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
|
6986 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
6987 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
|
6988 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6989 RECTL viewport, item; |
497
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6990 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
a7f478e9c20c
No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
489
diff
changeset
|
6991 |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6992 while(pCore) |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6993 { |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
6994 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
|
6995 { |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6996 QUERYRECORDRECT qrr; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6997 int scrollpixels = 0, midway; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6998 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
6999 qrr.cb = sizeof(QUERYRECORDRECT); |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7000 qrr.pRecord = pCore; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7001 qrr.fRightSplitWindow = 0; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7002 qrr.fsExtent = CMA_TEXT; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7003 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7004 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
|
7005 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
|
7006 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
|
7007 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7008 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
|
7009 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
|
7010 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7011 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
|
7012 return; |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7013 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7014 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7015 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
|
7016 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7017 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7018 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7019 /* |
167
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7020 * 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
|
7021 * Parameters: |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7022 * 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
|
7023 * 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
|
7024 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7025 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
|
7026 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7027 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
|
7028 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7029 while(pCore) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7030 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7031 if((char *)pCore->pszIcon == text) |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7032 { |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7033 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
|
7034 return; |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7035 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7036 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
|
7037 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7038 } |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7039 |
0b3debaa9c6c
Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
166
diff
changeset
|
7040 /* |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7041 * 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
|
7042 * Parameters: |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7043 * 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
|
7044 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7045 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
|
7046 { |
70
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7047 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
|
7048 RECTL item; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7049 PRECORDCORE pCore = NULL; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7050 int max = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7051 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7052 if(blah && !blah->flags) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7053 return; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7054 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7055 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
|
7056 while(pCore) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7057 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7058 QUERYRECORDRECT qrr; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7059 int vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7060 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7061 qrr.cb = sizeof(QUERYRECORDRECT); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7062 qrr.pRecord = pCore; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7063 qrr.fRightSplitWindow = 0; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7064 qrr.fsExtent = CMA_TEXT; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7065 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7066 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
|
7067 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7068 vector = item.xRight - item.xLeft; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7069 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7070 if(vector > max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7071 max = vector; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7072 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7073 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
|
7074 } |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7075 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7076 if(max) |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7077 { |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7078 CNRINFO cnri; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7079 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7080 cnri.cb = sizeof(CNRINFO); |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7081 cnri.xVertSplitbar = max; |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7082 |
5e7a4d93d8d7
Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
69
diff
changeset
|
7083 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
|
7084 } |
69
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7085 } |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7086 |
9510897c0b03
Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
68
diff
changeset
|
7087 /* |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7088 * Inserts an icon into the taskbar. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7089 * Parameters: |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7090 * handle: Window handle that will handle taskbar icon messages. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7091 * icon: Icon handle to display in the taskbar. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7092 * bubbletext: Text to show when the mouse is above the icon. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7093 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
7094 void API dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext) |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7095 { |
489
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7096 handle = handle; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7097 icon = icon; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7098 bubbletext = bubbletext; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7099 /* TODO */ |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7100 } |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7101 |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7102 /* |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7103 * Deletes an icon from the taskbar. |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7104 * Parameters: |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7105 * handle: Window handle that was used with dw_taskbar_insert(). |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7106 * icon: Icon handle that was used with dw_taskbar_insert(). |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7107 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
7108 void API dw_taskbar_delete(HWND handle, unsigned long icon) |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7109 { |
489
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7110 handle = handle; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7111 icon = icon; |
bc156294dd16
Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
487
diff
changeset
|
7112 /* TODO */ |
487
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7113 } |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7114 |
d6e07d292145
Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
485
diff
changeset
|
7115 /* |
3 | 7116 * Creates a rendering context widget (window) to be packed. |
7117 * Parameters: | |
7118 * id: An id to be used with dw_window_from_id. | |
7119 * Returns: | |
7120 * A handle to the widget or NULL on failure. | |
7121 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7122 HWND API dw_render_new(unsigned long id) |
3 | 7123 { |
7124 HWND hwndframe = WinCreateWindow(HWND_OBJECT, | |
7125 WC_FRAME, | |
7126 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
|
7127 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
|
7128 FS_NOBYTEALIGN, |
3 | 7129 0,0,2000,1000, |
7130 NULLHANDLE, | |
7131 HWND_TOP, | |
7132 id, | |
7133 NULL, | |
7134 NULL); | |
7135 WinSubclassWindow(hwndframe, _RendProc); | |
7136 return hwndframe; | |
7137 } | |
7138 | |
7139 /* Sets the current foreground drawing color. | |
7140 * Parameters: | |
7141 * red: red value. | |
7142 * green: green value. | |
7143 * blue: blue value. | |
7144 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7145 void API dw_color_foreground_set(unsigned long value) |
3 | 7146 { |
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
|
7147 _foreground = value; |
3 | 7148 } |
7149 | |
7150 /* Sets the current background drawing color. | |
7151 * Parameters: | |
7152 * red: red value. | |
7153 * green: green value. | |
7154 * blue: blue value. | |
7155 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7156 void API dw_color_background_set(unsigned long value) |
3 | 7157 { |
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
|
7158 _background = value; |
3 | 7159 } |
7160 | |
7161 HPS _set_hps(HPS hps) | |
7162 { | |
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
|
7163 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
|
7164 |
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
|
7165 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
|
7166 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background); |
3 | 7167 |
7168 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
|
7169 LCOL_RESET, |
3 | 7170 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
|
7171 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
|
7172 2, |
3 | 7173 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
|
7174 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
|
7175 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
|
7176 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
|
7177 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
|
7178 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
|
7179 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
|
7180 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
|
7181 GpiSetBackColor(hps, _internal_color(_background)); |
3 | 7182 return hps; |
7183 } | |
7184 | |
7185 HPS _set_colors(HWND handle) | |
7186 { | |
7187 HPS hps = WinGetPS(handle); | |
7188 | |
7189 _set_hps(hps); | |
7190 return hps; | |
7191 } | |
7192 | |
7193 /* Draw a point on a window (preferably a render window). | |
7194 * Parameters: | |
7195 * handle: Handle to the window. | |
7196 * pixmap: Handle to the pixmap. (choose only one of these) | |
7197 * x: X coordinate. | |
7198 * y: Y coordinate. | |
7199 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7200 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y) |
3 | 7201 { |
7202 HPS hps; | |
7203 int height; | |
7204 POINTL ptl; | |
7205 | |
7206 if(handle) | |
7207 { | |
7208 hps = _set_colors(handle); | |
7209 height = _get_height(handle); | |
7210 } | |
7211 else if(pixmap) | |
7212 { | |
7213 hps = _set_hps(pixmap->hps); | |
7214 height = pixmap->height; | |
7215 } | |
7216 else | |
7217 return; | |
7218 | |
7219 ptl.x = x; | |
7220 ptl.y = height - y - 1; | |
7221 | |
7222 GpiSetPel(hps, &ptl); | |
7223 if(!pixmap) | |
7224 WinReleasePS(hps); | |
7225 } | |
7226 | |
7227 /* Draw a line on a window (preferably a render window). | |
7228 * Parameters: | |
7229 * handle: Handle to the window. | |
7230 * pixmap: Handle to the pixmap. (choose only one of these) | |
7231 * x1: First X coordinate. | |
7232 * y1: First Y coordinate. | |
7233 * x2: Second X coordinate. | |
7234 * y2: Second Y coordinate. | |
7235 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7236 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2) |
3 | 7237 { |
7238 HPS hps; | |
7239 int height; | |
7240 POINTL ptl[2]; | |
7241 | |
7242 if(handle) | |
7243 { | |
7244 hps = _set_colors(handle); | |
7245 height = _get_height(handle); | |
7246 } | |
7247 else if(pixmap) | |
7248 { | |
7249 hps = _set_hps(pixmap->hps); | |
7250 height = pixmap->height; | |
7251 } | |
7252 else | |
7253 return; | |
7254 | |
7255 ptl[0].x = x1; | |
7256 ptl[0].y = height - y1 - 1; | |
7257 ptl[1].x = x2; | |
7258 ptl[1].y = height - y2 - 1; | |
7259 | |
7260 GpiMove(hps, &ptl[0]); | |
7261 GpiLine(hps, &ptl[1]); | |
7262 | |
7263 if(!pixmap) | |
7264 WinReleasePS(hps); | |
7265 } | |
7266 | |
7267 | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7268 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
|
7269 { |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7270 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
|
7271 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
|
7272 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
|
7273 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7274 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
|
7275 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7276 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
|
7277 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7278 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
|
7279 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
|
7280 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
|
7281 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7282 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
|
7283 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
|
7284 |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7285 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
|
7286 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
|
7287 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
|
7288 } |
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7289 |
3 | 7290 /* Draw text on a window (preferably a render window). |
7291 * Parameters: | |
7292 * handle: Handle to the window. | |
7293 * pixmap: Handle to the pixmap. (choose only one of these) | |
7294 * x: X coordinate. | |
7295 * y: Y coordinate. | |
7296 * text: Text to be displayed. | |
7297 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7298 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text) |
3 | 7299 { |
7300 HPS hps; | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7301 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
|
7302 RECTL rcl; |
3 | 7303 char fontname[128]; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7304 POINTL aptl[TXTBOX_COUNT]; |
3 | 7305 |
7306 if(handle) | |
7307 { | |
7308 hps = _set_colors(handle); | |
7309 height = _get_height(handle); | |
7310 _GetPPFont(handle, fontname); | |
7311 } | |
7312 else if(pixmap) | |
7313 { | |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7314 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
|
7315 |
3 | 7316 hps = _set_hps(pixmap->hps); |
7317 height = pixmap->height; | |
7318 _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
|
7319 _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
|
7320 WinReleasePS(pixmaphps); |
3 | 7321 } |
7322 else | |
7323 return; | |
7324 | |
7325 for(z=0;z<strlen(fontname);z++) | |
7326 { | |
7327 if(fontname[z]=='.') | |
7328 break; | |
7329 } | |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7330 |
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7331 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); |
3 | 7332 |
9
3383ed751a7e
New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
8
diff
changeset
|
7333 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
|
7334 rcl.yTop = height - y; |
220
d84054c1d587
Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
212
diff
changeset
|
7335 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
|
7336 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
|
7337 |
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
|
7338 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
|
7339 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
|
7340 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
|
7341 WinDrawText(hps, -1, text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); |
3 | 7342 |
7343 if(!pixmap) | |
7344 WinReleasePS(hps); | |
7345 } | |
7346 | |
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
|
7347 /* 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
|
7348 * 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
|
7349 * 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
|
7350 * 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
|
7351 * 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
|
7352 * 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
|
7353 * 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
|
7354 */ |
514
08d770271709
More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
513
diff
changeset
|
7355 void API dw_font_text_extents_get(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
|
7356 { |
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
|
7357 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
|
7358 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
|
7359 |
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
|
7360 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
|
7361 { |
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
|
7362 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
|
7363 } |
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
|
7364 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
|
7365 { |
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
|
7366 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
|
7367 |
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
|
7368 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
|
7369 _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
|
7370 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
|
7371 } |
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
|
7372 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
|
7373 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
|
7374 |
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
|
7375 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
|
7376 |
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
|
7377 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
|
7378 *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
|
7379 |
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
|
7380 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
|
7381 *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
|
7382 |
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
|
7383 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
|
7384 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
|
7385 } |
3 | 7386 |
7387 /* Draw a rectangle on a window (preferably a render window). | |
7388 * Parameters: | |
7389 * handle: Handle to the window. | |
7390 * pixmap: Handle to the pixmap. (choose only one of these) | |
7391 * fill: Fill box TRUE or FALSE. | |
7392 * x: X coordinate. | |
7393 * y: Y coordinate. | |
7394 * width: Width of rectangle. | |
7395 * height: Height of rectangle. | |
7396 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7397 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) |
3 | 7398 { |
7399 HPS hps; | |
7400 int thisheight; | |
7401 POINTL ptl[2]; | |
7402 | |
7403 if(handle) | |
7404 { | |
7405 hps = _set_colors(handle); | |
7406 thisheight = _get_height(handle); | |
7407 } | |
7408 else if(pixmap) | |
7409 { | |
7410 hps = _set_hps(pixmap->hps); | |
7411 thisheight = pixmap->height; | |
7412 } | |
7413 else | |
7414 return; | |
7415 | |
7416 ptl[0].x = x; | |
7417 ptl[0].y = thisheight - y - 1; | |
7418 ptl[1].x = x + width - 1; | |
7419 ptl[1].y = thisheight - y - height; | |
7420 | |
7421 GpiMove(hps, &ptl[0]); | |
7422 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); | |
7423 | |
7424 if(!pixmap) | |
7425 WinReleasePS(hps); | |
7426 } | |
7427 | |
7428 /* Call this after drawing to the screen to make sure | |
7429 * anything you have drawn is visible. | |
7430 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7431 void API dw_flush(void) |
3 | 7432 { |
7433 } | |
7434 | |
7435 /* | |
7436 * Creates a pixmap with given parameters. | |
7437 * Parameters: | |
7438 * handle: Window handle the pixmap is associated with. | |
7439 * width: Width of the pixmap in pixels. | |
7440 * height: Height of the pixmap in pixels. | |
7441 * depth: Color depth of the pixmap. | |
7442 * Returns: | |
7443 * A handle to a pixmap or NULL on failure. | |
7444 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7445 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth) |
3 | 7446 { |
7447 BITMAPINFOHEADER bmih; | |
7448 SIZEL sizl = { 0, 0 }; | |
7449 HPIXMAP pixmap; | |
7450 HDC hdc; | |
7451 HPS hps; | |
7452 ULONG ulFlags; | |
7453 LONG cPlanes, cBitCount; | |
7454 | |
7455 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7456 return NULL; | |
7457 | |
7458 hps = WinGetPS(handle); | |
7459 | |
7460 hdc = GpiQueryDevice(hps); | |
7461 ulFlags = GpiQueryPS(hps, &sizl); | |
7462 | |
7463 pixmap->handle = handle; | |
7464 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
7465 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
7466 | |
7467 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes); | |
7468 if (!depth) | |
7469 { | |
7470 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount); | |
7471 depth = cBitCount; | |
7472 } | |
7473 | |
7474 memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); | |
7475 bmih.cbFix = sizeof(BITMAPINFOHEADER); | |
7476 bmih.cx = (SHORT)width; | |
7477 bmih.cy = (SHORT)height; | |
7478 bmih.cPlanes = (SHORT)cPlanes; | |
7479 bmih.cBitCount = (SHORT)depth; | |
7480 | |
7481 pixmap->width = width; pixmap->height = height; | |
7482 | |
7483 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL); | |
7484 | |
7485 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
7486 | |
7487 if (depth>8) | |
7488 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL ); | |
7489 | |
7490 WinReleasePS(hps); | |
7491 | |
7492 return pixmap; | |
7493 } | |
7494 | |
7495 /* | |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7496 * Creates a pixmap from a file. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7497 * Parameters: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7498 * 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
|
7499 * 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
|
7500 * DW pick the appropriate file extension. |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7501 * (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
|
7502 * Returns: |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7503 * 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
|
7504 */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7505 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
|
7506 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7507 HPIXMAP pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7508 char *file = alloca(strlen(filename) + 5); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7509 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7510 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
|
7511 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7512 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7513 strcpy(file, filename); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7514 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7515 /* 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
|
7516 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7517 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7518 /* Try with .bmp extention */ |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7519 strcat(file, ".bmp"); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7520 if(access(file, 04) != 0) |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7521 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7522 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7523 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7524 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7525 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7526 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7527 /* 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
|
7528 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
|
7529 { |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7530 free(pixmap); |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7531 return NULL; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7532 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7533 |
278
df0665ba147f
Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
276
diff
changeset
|
7534 /* Success fill in other values */ |
241
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7535 pixmap->handle = handle; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7536 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7537 return pixmap; |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7538 } |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7539 |
00d2b1bcf036
Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
236
diff
changeset
|
7540 /* |
3 | 7541 * Creates a pixmap from internal resource graphic specified by id. |
7542 * Parameters: | |
7543 * handle: Window handle the pixmap is associated with. | |
7544 * id: Resource ID associated with requested pixmap. | |
7545 * Returns: | |
7546 * A handle to a pixmap or NULL on failure. | |
7547 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7548 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id) |
3 | 7549 { |
7550 BITMAPINFOHEADER bmih; | |
7551 SIZEL sizl = { 0, 0 }; | |
7552 HPIXMAP pixmap; | |
7553 HDC hdc; | |
7554 HPS hps; | |
7555 ULONG ulFlags; | |
7556 | |
7557 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | |
7558 return NULL; | |
7559 | |
7560 hps = WinGetPS(handle); | |
7561 | |
7562 hdc = GpiQueryDevice(hps); | |
7563 ulFlags = GpiQueryPS(hps, &sizl); | |
7564 | |
7565 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); | |
7566 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); | |
7567 | |
7568 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0); | |
7569 | |
7570 GpiQueryBitmapParameters(pixmap->hbm, &bmih); | |
7571 | |
7572 GpiSetBitmap(pixmap->hps, pixmap->hbm); | |
7573 | |
7574 pixmap->width = bmih.cx; pixmap->height = bmih.cy; | |
7575 | |
7576 WinReleasePS(hps); | |
7577 | |
7578 return pixmap; | |
7579 } | |
7580 | |
7581 /* | |
7582 * Destroys an allocated pixmap. | |
7583 * Parameters: | |
7584 * pixmap: Handle to a pixmap returned by | |
7585 * dw_pixmap_new.. | |
7586 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7587 void API dw_pixmap_destroy(HPIXMAP pixmap) |
3 | 7588 { |
7589 GpiSetBitmap(pixmap->hps, NULLHANDLE); | |
7590 GpiDeleteBitmap(pixmap->hbm); | |
7591 GpiAssociate(pixmap->hps, NULLHANDLE); | |
7592 GpiDestroyPS(pixmap->hps); | |
7593 DevCloseDC(pixmap->hdc); | |
7594 free(pixmap); | |
7595 } | |
7596 | |
7597 /* | |
7598 * Copies from one item to another. | |
7599 * Parameters: | |
7600 * dest: Destination window handle. | |
7601 * destp: Destination pixmap. (choose only one). | |
7602 * xdest: X coordinate of destination. | |
7603 * ydest: Y coordinate of destination. | |
7604 * width: Width of area to copy. | |
7605 * height: Height of area to copy. | |
7606 * src: Source window handle. | |
7607 * srcp: Source pixmap. (choose only one). | |
7608 * xsrc: X coordinate of source. | |
7609 * ysrc: Y coordinate of source. | |
7610 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7611 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 | 7612 { |
7613 HPS hpsdest; | |
7614 HPS hpssrc; | |
7615 POINTL ptl[4]; | |
7616 int destheight, srcheight; | |
7617 | |
7618 if(dest) | |
7619 { | |
7620 hpsdest = WinGetPS(dest); | |
7621 destheight = _get_height(dest); | |
7622 } | |
7623 else if(destp) | |
7624 { | |
7625 hpsdest = destp->hps; | |
7626 destheight = destp->height; | |
7627 } | |
7628 else | |
7629 return; | |
7630 | |
7631 if(src) | |
7632 { | |
7633 hpssrc = WinGetPS(src); | |
7634 srcheight = _get_height(src); | |
7635 } | |
7636 else if(srcp) | |
7637 { | |
7638 hpssrc = srcp->hps; | |
7639 srcheight = srcp->height; | |
7640 } | |
7641 else | |
7642 { | |
7643 if(!destp) | |
7644 WinReleasePS(hpsdest); | |
7645 return; | |
7646 } | |
7647 | |
7648 ptl[0].x = xdest; | |
7649 ptl[0].y = (destheight - ydest) - height; | |
7650 ptl[1].x = ptl[0].x + width; | |
7651 ptl[1].y = destheight - ydest; | |
7652 ptl[2].x = xsrc; | |
7653 ptl[2].y = srcheight - (ysrc + height); | |
7654 ptl[3].x = ptl[2].x + width; | |
7655 ptl[3].y = ptl[2].y + height; | |
7656 | |
7657 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE); | |
7658 | |
7659 if(!destp) | |
7660 WinReleasePS(hpsdest); | |
7661 if(!srcp) | |
7662 WinReleasePS(hpssrc); | |
7663 } | |
7664 | |
527
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7665 /* Run DosBeep() in a separate thread so it doesn't block */ |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7666 void _beepthread(void *data) |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7667 { |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7668 int *info = (int *)data; |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7669 |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7670 if(data) |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7671 { |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7672 DosBeep(info[0], info[1]); |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7673 free(data); |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7674 } |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7675 } |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7676 |
3 | 7677 /* |
7678 * Emits a beep. | |
7679 * Parameters: | |
7680 * freq: Frequency. | |
7681 * dur: Duration. | |
7682 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7683 void API dw_beep(int freq, int dur) |
3 | 7684 { |
527
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7685 int *info = malloc(sizeof(int) * 2); |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7686 |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7687 if(info) |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7688 { |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7689 info[0] = freq; |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7690 info[1] = dur; |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7691 |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7692 _beginthread(_beepthread, NULL, 100, (void *)info); |
e0ea29c3d1eb
Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
526
diff
changeset
|
7693 } |
3 | 7694 } |
7695 | |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7696 /* Open a shared library and return a handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7697 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7698 * name: Base name of the shared library. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7699 * handle: Pointer to a module handle, |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7700 * will be filled in with the handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7701 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7702 int API dw_module_load(char *name, HMOD *handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7703 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7704 char objnamebuf[300] = ""; |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7705 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7706 return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7707 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7708 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7709 /* Queries the address of a symbol within open handle. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7710 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7711 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7712 * name: Name of the symbol you want the address of. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7713 * func: A pointer to a function pointer, to obtain |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7714 * the address. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7715 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7716 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
|
7717 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7718 return DosQueryProcAddr(handle, 0, name, (PFN*)func); |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7719 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7720 |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7721 /* Frees the shared library previously opened. |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7722 * Parameters: |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7723 * handle: Module handle returned by dw_module_load() |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7724 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7725 int API dw_module_close(HMOD handle) |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7726 { |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7727 DosFreeModule(handle); |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
7728 return 0; |
157
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7729 } |
a07dd2e819f3
Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
156
diff
changeset
|
7730 |
3 | 7731 /* |
7732 * Returns the handle to an unnamed mutex semaphore. | |
7733 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7734 HMTX API dw_mutex_new(void) |
3 | 7735 { |
7736 HMTX mutex; | |
7737 | |
7738 DosCreateMutexSem(NULL, &mutex, 0, FALSE); | |
7739 return mutex; | |
7740 } | |
7741 | |
7742 /* | |
7743 * Closes a semaphore created by dw_mutex_new(). | |
7744 * Parameters: | |
7745 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7746 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7747 void API dw_mutex_close(HMTX mutex) |
3 | 7748 { |
7749 DosCloseMutexSem(mutex); | |
7750 } | |
7751 | |
7752 /* | |
7753 * 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
|
7754 * 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
|
7755 * while blocking. |
3 | 7756 * Parameters: |
7757 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7758 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7759 void API dw_mutex_lock(HMTX mutex) |
3 | 7760 { |
63
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7761 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
|
7762 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7763 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
|
7764 |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7765 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
|
7766 { |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7767 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
|
7768 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
|
7769 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7770 } |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7771 else |
a6801a2260af
Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
62
diff
changeset
|
7772 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT); |
3 | 7773 } |
7774 | |
7775 /* | |
7776 * Reliquishes the access to the semaphore. | |
7777 * Parameters: | |
7778 * mutex: The handle to the mutex returned by dw_mutex_new(). | |
7779 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7780 void API dw_mutex_unlock(HMTX mutex) |
3 | 7781 { |
7782 DosReleaseMutexSem(mutex); | |
7783 } | |
7784 | |
7785 /* | |
7786 * Returns the handle to an unnamed event semaphore. | |
7787 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7788 HEV API dw_event_new(void) |
3 | 7789 { |
7790 HEV blah; | |
7791 | |
7792 if(DosCreateEventSem (NULL, &blah, 0L, FALSE)) | |
7793 return 0; | |
7794 | |
7795 return blah; | |
7796 } | |
7797 | |
7798 /* | |
7799 * Resets a semaphore created by dw_event_new(). | |
7800 * Parameters: | |
7801 * eve: The handle to the event returned by dw_event_new(). | |
7802 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7803 int API dw_event_reset(HEV eve) |
3 | 7804 { |
7805 ULONG count; | |
7806 | |
7807 if(DosResetEventSem(eve, &count)) | |
7808 return FALSE; | |
7809 return TRUE; | |
7810 } | |
7811 | |
7812 /* | |
7813 * Posts a semaphore created by dw_event_new(). Causing all threads | |
7814 * waiting on this event in dw_event_wait to continue. | |
7815 * Parameters: | |
7816 * eve: The handle to the event returned by dw_event_new(). | |
7817 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7818 int API dw_event_post(HEV eve) |
3 | 7819 { |
7820 if(DosPostEventSem(eve)) | |
7821 return FALSE; | |
7822 return TRUE; | |
7823 } | |
7824 | |
7825 | |
7826 /* | |
7827 * Waits on a semaphore created by dw_event_new(), until the | |
7828 * event gets posted or until the timeout expires. | |
7829 * Parameters: | |
7830 * eve: The handle to the event returned by dw_event_new(). | |
7831 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7832 int API dw_event_wait(HEV eve, unsigned long timeout) |
3 | 7833 { |
7834 int rc = DosWaitEventSem(eve, timeout); | |
7835 if(!rc) | |
7836 return 1; | |
7837 if(rc == ERROR_TIMEOUT) | |
7838 return -1; | |
7839 return 0; | |
7840 } | |
7841 | |
7842 /* | |
7843 * Closes a semaphore created by dw_event_new(). | |
7844 * Parameters: | |
7845 * eve: The handle to the event returned by dw_event_new(). | |
7846 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7847 int API dw_event_close(HEV *eve) |
3 | 7848 { |
7849 if(!eve || ~DosCloseEventSem(*eve)) | |
7850 return FALSE; | |
7851 return TRUE; | |
7852 } | |
7853 | |
7854 /* | |
7855 * Encapsulate the message queues on OS/2. | |
7856 */ | |
7857 void _dwthreadstart(void *data) | |
7858 { | |
7859 HAB thishab = WinInitialize(0); | |
7860 HMQ thishmq = WinCreateMsgQueue(dwhab, 0); | |
7861 void (*threadfunc)(void *) = NULL; | |
7862 void **tmp = (void **)data; | |
7863 | |
7864 threadfunc = (void (*)(void *))tmp[0]; | |
7865 threadfunc(tmp[1]); | |
7866 | |
7867 free(tmp); | |
7868 | |
7869 WinDestroyMsgQueue(thishmq); | |
7870 WinTerminate(thishab); | |
7871 } | |
7872 | |
7873 /* | |
7874 * Creates a new thread with a starting point of func. | |
7875 * Parameters: | |
7876 * func: Function which will be run in the new thread. | |
7877 * data: Parameter(s) passed to the function. | |
7878 * stack: Stack size of new thread (OS/2 and Windows only). | |
7879 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7880 DWTID API dw_thread_new(void *func, void *data, int stack) |
3 | 7881 { |
7882 void **tmp = malloc(sizeof(void *) * 2); | |
7883 | |
7884 tmp[0] = func; | |
7885 tmp[1] = data; | |
7886 | |
7887 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp); | |
7888 } | |
7889 | |
7890 /* | |
7891 * Ends execution of current thread immediately. | |
7892 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7893 void API dw_thread_end(void) |
3 | 7894 { |
7895 _endthread(); | |
7896 } | |
7897 | |
7898 /* | |
7899 * Returns the current thread's ID. | |
7900 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7901 DWTID API dw_thread_id(void) |
3 | 7902 { |
7903 return (DWTID)_threadid; | |
7904 } | |
7905 | |
7906 /* | |
7907 * Cleanly terminates a DW session, should be signal handler safe. | |
7908 * Parameters: | |
7909 * exitcode: Exit code reported to the operating system. | |
7910 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7911 void API dw_exit(int exitcode) |
3 | 7912 { |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
7913 /* Destroy the menu message window */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
7914 dw_window_destroy(hwndApp); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
7915 |
3 | 7916 /* In case we are in a signal handler, don't |
7917 * try to free memory that could possibly be | |
7918 * free()'d by the runtime already. | |
7919 */ | |
7920 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
|
7921 |
3 | 7922 exit(exitcode); |
7923 } | |
7924 | |
7925 /* | |
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
|
7926 * 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
|
7927 * 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
|
7928 * 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
|
7929 * 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
|
7930 * 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
|
7931 * 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
|
7932 * 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
|
7933 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7934 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
|
7935 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7936 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
|
7937 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
|
7938 NULL, |
137
6a18312049fd
The splitbar needs to have the WS_CLIPCHILDREN style set.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
136
diff
changeset
|
7939 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
|
7940 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
|
7941 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
|
7942 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
|
7943 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
|
7944 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
|
7945 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
|
7946 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
|
7947 { |
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
|
7948 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
|
7949 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
|
7950 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7951 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
|
7952 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
|
7953 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
|
7954 |
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
|
7955 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
|
7956 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
|
7957 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
|
7958 *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
|
7959 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
|
7960 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
|
7961 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
|
7962 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7963 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
|
7964 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7965 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7966 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7967 * 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
|
7968 * 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
|
7969 * 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
|
7970 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7971 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
|
7972 { |
123
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7973 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
|
7974 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
|
7975 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
|
7976 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7977 if(mypercent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7978 *mypercent = percent; |
125
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7979 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7980 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
|
7981 |
0d2cbd9d4028
Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
124
diff
changeset
|
7982 _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
|
7983 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7984 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7985 /* |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
7986 * 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
|
7987 * 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
|
7988 * 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
|
7989 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
7990 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
|
7991 { |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7992 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
|
7993 |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7994 if(percent) |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7995 return *percent; |
63f61a702b17
Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
119
diff
changeset
|
7996 return 0.0; |
3 | 7997 } |
7998 | |
7999 /* | |
8000 * Pack windows (widgets) into a box from the start (or top). | |
8001 * Parameters: | |
8002 * box: Window handle of the box to be packed into. | |
8003 * item: Window handle of the item to be back. | |
8004 * width: Width in pixels of the item or -1 to be self determined. | |
8005 * height: Height in pixels of the item or -1 to be self determined. | |
8006 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | |
8007 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | |
8008 * pad: Number of pixels of padding around the item. | |
8009 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8010 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
3 | 8011 { |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8012 char *funcname = "dw_box_pack_start()"; |
3 | 8013 |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8014 /* |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8015 * If you try and pack an item into itself VERY bad things can happen; like at least an |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8016 * infinite loop on GTK! Lets be safe! |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8017 */ |
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
|
8018 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
|
8019 { |
526
d3ce0afa6cf5
Remove extraneous arguments to dw_messagebox()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
523
diff
changeset
|
8020 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!"); |
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
|
8021 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
|
8022 } |
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
|
8023 |
3 | 8024 if(WinWindowFromID(box, FID_CLIENT)) |
8025 { | |
8026 box = WinWindowFromID(box, FID_CLIENT); | |
8027 hsize = TRUE; | |
8028 vsize = TRUE; | |
8029 } | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8030 _dw_box_pack_start(box, item, width, height, hsize, vsize, pad, funcname); |
462
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8031 } |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8032 |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8033 void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8034 { |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8035 Box *thisbox = WinQueryWindowPtr(box, QWP_USER); |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8036 |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8037 if(thisbox) |
9d874ce0124a
Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
458
diff
changeset
|
8038 { |
3 | 8039 int z; |
8040 Item *tmpitem, *thisitem = thisbox->items; | |
8041 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
|
8042 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box"); |
3 | 8043 |
8044 tmpitem = malloc(sizeof(Item)*(thisbox->count+1)); | |
8045 | |
8046 for(z=0;z<thisbox->count;z++) | |
8047 { | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8048 tmpitem[z] = thisitem[z]; |
3 | 8049 } |
8050 | |
8051 WinQueryClassName(item, 99, tmpbuf); | |
8052 | |
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
|
8053 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
|
8054 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
|
8055 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
|
8056 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
|
8057 |
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
|
8058 if(strncmp(tmpbuf, "#1", 3)==0) |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8059 tmpitem[thisbox->count].type = TYPEBOX; |
3 | 8060 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
|
8061 { |
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
|
8062 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
|
8063 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
|
8064 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
|
8065 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
|
8066 |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8067 tmpitem[thisbox->count].type = TYPEITEM; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8068 } |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8069 |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8070 tmpitem[thisbox->count].hwnd = item; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8071 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8072 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height; |
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8073 tmpitem[thisbox->count].pad = pad; |
3 | 8074 if(hsize) |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8075 tmpitem[thisbox->count].hsize = SIZEEXPAND; |
3 | 8076 else |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8077 tmpitem[thisbox->count].hsize = SIZESTATIC; |
3 | 8078 |
8079 if(vsize) | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8080 tmpitem[thisbox->count].vsize = SIZEEXPAND; |
3 | 8081 else |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8082 tmpitem[thisbox->count].vsize = SIZESTATIC; |
3 | 8083 |
8084 thisbox->items = tmpitem; | |
8085 | |
8086 if(thisbox->count) | |
8087 free(thisitem); | |
8088 | |
8089 thisbox->count++; | |
8090 | |
535
b0b5b880513a
Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
531
diff
changeset
|
8091 /* Don't set the ownership if it's an entryfield or spinbutton */ |
3 | 8092 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
|
8093 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
|
8094 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
|
8095 WinSetParent(frame ? frame : item, box, FALSE); |
3 | 8096 } |
8097 } | |
8098 | |
8099 /* The following two functions graciously contributed by Peter Nielsen. */ | |
8100 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) { | |
8101 char* pchStart = pchBuffer; | |
8102 char* pchEnd = pchStart + ulSize - 2; | |
8103 | |
8104 while (pchEnd >= pchStart) | |
8105 { | |
8106 if ((pchEnd[0] == '#') && (pchEnd[1] == '@')) | |
8107 { | |
8108 *pchEnd-- = '\0'; | |
8109 while (pchEnd >= pchStart) | |
8110 { | |
8111 if ((pchEnd[0] == '@') && (pchEnd[1] == '#')) | |
8112 { | |
8113 ULONG ulMajor = 0; | |
8114 ULONG ulMinor = 0; | |
8115 | |
8116 char* pch = pchEnd + 2; | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
8117 while (!isdigit ((int)*pch) && *pch) |
3 | 8118 pch++; |
8119 | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
8120 while (isdigit ((int)*pch)) |
3 | 8121 ulMajor = ulMajor * 10 + *pch++ - '0'; |
8122 | |
8123 if (*pch == '.') | |
8124 { | |
154
7f8fcce45bdd
Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
153
diff
changeset
|
8125 while (isdigit ((int)*++pch)) |
3 | 8126 ulMinor = ulMinor * 10 + *pch - '0'; |
8127 } | |
8128 return ((ulMajor << 16) | ulMinor); | |
8129 } | |
8130 pchEnd--; | |
8131 } | |
8132 } | |
8133 pchEnd--; | |
8134 } | |
8135 return (0); | |
8136 } | |
8137 | |
8138 ULONG _GetSystemBuildLevel(void) { | |
8139 /* 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. | |
8140 * 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. | |
8141 */ | |
8142 ULONG ulBootDrive = 0; | |
8143 ULONG ulBuild = 0; | |
8144 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR) | |
8145 { | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8146 char achFileName[11] = "C:\\OS2KRNL"; |
3 | 8147 HFILE hfile; |
8148 ULONG ulResult; | |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8149 |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8150 achFileName[0] = (char)('A'+ulBootDrive-1); |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8151 |
3 | 8152 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) |
8153 { | |
8154 ULONG ulFileSize = 0; | |
8155 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR) | |
8156 { | |
8157 const ULONG ulFirstTry = min (256, ulFileSize); | |
8158 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR) | |
8159 { | |
8160 char *pchBuffer = malloc(ulFirstTry); | |
8161 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR) | |
8162 { | |
8163 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry); | |
8164 if (ulBuild == 0) | |
8165 { | |
8166 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR) | |
8167 { | |
8168 free(pchBuffer); | |
8169 pchBuffer = malloc(ulFileSize); | |
8170 | |
8171 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR) | |
8172 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize); | |
8173 } | |
8174 } | |
8175 } | |
8176 free(pchBuffer); | |
8177 } | |
8178 } | |
8179 DosClose (hfile); | |
8180 } | |
8181 } | |
8182 return (ulBuild); | |
8183 } | |
8184 | |
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
|
8185 /* |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8186 * 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
|
8187 * 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
|
8188 * 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
|
8189 * 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
|
8190 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8191 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
|
8192 { |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8193 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
|
8194 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
|
8195 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8196 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
|
8197 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
|
8198 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
|
8199 |
b03b24bb95f8
Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
33
diff
changeset
|
8200 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
|
8201 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
|
8202 } |
3 | 8203 |
8204 /* | |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8205 * 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
|
8206 * Parameters: |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8207 * 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
|
8208 * 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
|
8209 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8210 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
|
8211 { |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8212 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
|
8213 |
7c3eef54c98c
Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
93
diff
changeset
|
8214 if(blah) |
40
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8215 blah->clickdefault = next; |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8216 } |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8217 |
88c9c7410c22
Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
39
diff
changeset
|
8218 /* |
3 | 8219 * Returns some information about the current operating environment. |
8220 * Parameters: | |
8221 * env: Pointer to a DWEnv struct. | |
8222 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8223 void API dw_environment_query(DWEnv *env) |
3 | 8224 { |
8225 ULONG Build; | |
8226 | |
8227 if(!env) | |
8228 return; | |
8229 | |
8230 /* The default is OS/2 2.0 */ | |
8231 strcpy(env->osName,"OS/2"); | |
8232 env->MajorVersion = 2; | |
8233 env->MinorVersion = 0; | |
8234 | |
8235 Build = _GetSystemBuildLevel(); | |
8236 env->MinorBuild = Build & 0xFFFF; | |
8237 env->MajorBuild = Build >> 16; | |
8238 | |
8239 if (aulBuffer[0] == 20) | |
8240 { | |
8241 int i = (unsigned int)aulBuffer[1]; | |
8242 if (i > 20) | |
8243 { | |
8244 strcpy(env->osName,"Warp"); | |
8245 env->MajorVersion = (int)i/10; | |
8246 env->MinorVersion = i-(((int)i/10)*10); | |
8247 } | |
8248 else if (i == 10) | |
8249 env->MinorVersion = 1; | |
8250 } | |
15
81833f25b1aa
Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
14
diff
changeset
|
8251 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
|
8252 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
|
8253 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
|
8254 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
|
8255 env->DWSubVersion = DW_SUB_VERSION; |
3 | 8256 } |
8257 | |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8258 /* The next few functions are support functions for the OS/2 folder browser */ |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8259 void _populate_directory(HWND tree, HTREEITEM parent, char *path) |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8260 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8261 FILEFINDBUF3 ffbuf; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8262 HTREEITEM item; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8263 ULONG count = 1; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8264 HDIR hdir = HDIR_CREATE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8265 |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8266 if(DosFindFirst(path, &hdir, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED | MUST_HAVE_DIRECTORY, |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8267 &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR) |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8268 { |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8269 while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR) |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8270 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8271 if(strcmp(ffbuf.achName, ".") && strcmp(ffbuf.achName, "..")) |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8272 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8273 int len = strlen(path); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8274 char *folder = malloc(len + ffbuf.cchName + 2); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8275 HTREEITEM tempitem; |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8276 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8277 strcpy(folder, path); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8278 strcpy(&folder[len-1], ffbuf.achName); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8279 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8280 item = dw_tree_insert(tree, ffbuf.achName, WinLoadFileIcon(folder, TRUE), parent, (void *)parent); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8281 tempitem = dw_tree_insert(tree, "", 0, item, 0); |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8282 dw_tree_item_set_data(tree, item, (void *)tempitem); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8283 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8284 } |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8285 DosFindClose(hdir); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8286 } |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8287 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8288 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8289 void _populate_tree_thread(void *data) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8290 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8291 HWND window = (HWND)data, tree = (HWND)dw_window_get_data(window, "_dw_tree"); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8292 HMTX mtx = (HMTX)dw_window_get_data(window, "_dw_mutex"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8293 int drive; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8294 HTREEITEM items[26]; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8295 FSINFO volinfo; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8296 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8297 DosError(FERR_DISABLEHARDERR); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8298 |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8299 dw_mutex_lock(mtx); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8300 for(drive=0;drive<26;drive++) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8301 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8302 if(DosQueryFSInfo(drive+1, FSIL_VOLSER,(PVOID)&volinfo, sizeof(FSINFO)) == NO_ERROR) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8303 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8304 char folder[5] = "C:\\", name[9] = "Drive C:"; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8305 HTREEITEM tempitem; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8306 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8307 folder[0] = name[6] = 'A' + drive; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8308 |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8309 items[drive] = dw_tree_insert(tree, name, WinLoadFileIcon(folder, TRUE), NULL, 0); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8310 tempitem = dw_tree_insert(tree, "", 0, items[drive], 0); |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8311 dw_tree_item_set_data(tree, items[drive], (void *)tempitem); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8312 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8313 else |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8314 items[drive] = 0; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8315 } |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8316 dw_mutex_unlock(mtx); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8317 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8318 DosError(FERR_ENABLEHARDERR); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8319 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8320 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8321 int DWSIGNAL _dw_ok_func(HWND window, void *data) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8322 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8323 DWDialog *dwwait = (DWDialog *)data; |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8324 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex"); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8325 void *treedata; |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8326 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8327 window = window; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8328 if(!dwwait) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8329 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8330 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8331 dw_mutex_lock(mtx); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8332 treedata = dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8333 dw_mutex_close(mtx); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8334 dw_window_destroy((HWND)dwwait->data); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8335 dw_dialog_dismiss((DWDialog *)data, treedata); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8336 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8337 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8338 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8339 int DWSIGNAL _dw_cancel_func(HWND window, void *data) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8340 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8341 DWDialog *dwwait = (DWDialog *)data; |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8342 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex"); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8343 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8344 window = window; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8345 if(!dwwait) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8346 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8347 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8348 dw_mutex_lock(mtx); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8349 dw_mutex_close(mtx); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8350 dw_window_destroy((HWND)dwwait->data); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8351 dw_dialog_dismiss((DWDialog *)data, NULL); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8352 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8353 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8354 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8355 char *_tree_folder(HWND tree, HTREEITEM item) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8356 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8357 char *folder=strdup(""); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8358 HTREEITEM parent = item; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8359 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8360 while(parent) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8361 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8362 char *temp, *text = dw_tree_get_title(tree, parent); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8363 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8364 if(text) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8365 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8366 if(strncmp(text, "Drive ", 6) == 0) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8367 text = &text[6]; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8368 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8369 temp = malloc(strlen(text) + strlen(folder) + 3); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8370 strcpy(temp, text); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8371 strcat(temp, "\\"); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8372 strcat(temp, folder); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8373 free(folder); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8374 folder = temp; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8375 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8376 parent = dw_tree_get_parent(tree, parent); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8377 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8378 return folder; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8379 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8380 |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8381 int DWSIGNAL _item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8382 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8383 DWDialog *dwwait = (DWDialog *)data; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8384 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8385 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8386 text = text; itemdata = itemdata; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8387 if(treedata) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8388 free(treedata); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8389 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8390 treedata = _tree_folder(window, item); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8391 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8392 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8393 return FALSE; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8394 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8395 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8396 int DWSIGNAL _tree_expand(HWND window, HTREEITEM item, void *data) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8397 { |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8398 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(window, item); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8399 |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8400 data = data; |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8401 if(tempitem) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8402 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8403 char *folder = _tree_folder(window, item); |
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8404 |
513
7755599311d4
Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
511
diff
changeset
|
8405 dw_tree_item_set_data(window, item, 0); |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8406 dw_tree_item_delete(window, tempitem); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8407 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8408 if(*folder) |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8409 { |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8410 strcat(folder, "*"); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8411 _populate_directory(window, item, folder); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8412 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8413 free(folder); |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8414 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8415 |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8416 return FALSE; |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8417 } |
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8418 |
3 | 8419 /* |
8420 * Opens a file dialog and queries user selection. | |
8421 * Parameters: | |
8422 * title: Title bar text for dialog. | |
8423 * defpath: The default path of the open dialog. | |
8424 * ext: Default file extention. | |
8425 * flags: DW_FILE_OPEN or DW_FILE_SAVE. | |
8426 * Returns: | |
8427 * NULL on error. A malloced buffer containing | |
8428 * the file path on success. | |
8429 * | |
8430 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8431 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags) |
3 | 8432 { |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8433 if(flags == DW_DIRECTORY_OPEN) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8434 { |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8435 HWND window, hbox, vbox, tree, button; |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8436 DWDialog *dwwait; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8437 HMTX mtx = dw_mutex_new(); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8438 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8439 window = dw_window_new( HWND_DESKTOP, title, FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8440 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8441 vbox = dw_box_new(DW_VERT, 5); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8442 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8443 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8444 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8445 tree = dw_tree_new(60); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8446 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8447 dw_box_pack_start(vbox, tree, 1, 1, TRUE, TRUE, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8448 dw_window_set_data(window, "_dw_mutex", (void *)mtx); |
485
469ff8133ed3
Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
478
diff
changeset
|
8449 dw_window_set_data(window, "_dw_tree", (void *)tree); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8450 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8451 hbox = dw_box_new(DW_HORZ, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8452 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8453 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8454 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8455 dwwait = dw_dialog_new((void *)window); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8456 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8457 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_item_select), (void *)dwwait); |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8458 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8459 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8460 button = dw_button_new("Ok", 1001L); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8461 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8462 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8463 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8464 button = dw_button_new("Cancel", 1002L); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8465 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8466 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8467 |
510
710f82598210
Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
508
diff
changeset
|
8468 dw_window_set_size(window, 225, 300); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8469 dw_window_show(window); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8470 |
478
ea099ba917c6
Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
477
diff
changeset
|
8471 dw_thread_new((void *)_populate_tree_thread, (void *)window, 0xff); |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8472 return (char *)dw_dialog_wait(dwwait); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8473 } |
3 | 8474 else |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8475 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8476 FILEDLG fild; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8477 HWND hwndFile; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8478 int len; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8479 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8480 if(defpath) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8481 strcpy(fild.szFullFile, defpath); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8482 else |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8483 strcpy(fild.szFullFile, ""); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8484 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8485 len = strlen(fild.szFullFile); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8486 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8487 if(len) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8488 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8489 if(fild.szFullFile[len-1] != '\\') |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8490 strcat(fild.szFullFile, "\\"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8491 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8492 strcat(fild.szFullFile, "*"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8493 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8494 if(ext) |
3 | 8495 { |
476
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8496 strcat(fild.szFullFile, "."); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8497 strcat(fild.szFullFile, ext); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8498 } |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8499 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8500 memset(&fild, 0, sizeof(FILEDLG)); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8501 fild.cbSize = sizeof(FILEDLG); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8502 fild.fl = FDS_CENTER | FDS_OPEN_DIALOG; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8503 fild.pszTitle = title; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8504 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open"); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8505 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8506 |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8507 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8508 if(hwndFile) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8509 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8510 switch(fild.lReturn) |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8511 { |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8512 case DID_OK: |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8513 return strdup(fild.szFullFile); |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8514 case DID_CANCEL: |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8515 return NULL; |
a84ee39e7aea
Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
475
diff
changeset
|
8516 } |
3 | 8517 } |
8518 } | |
8519 return NULL; | |
8520 } | |
8521 | |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8522 /* 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
|
8523 int _SetPath(char *path) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8524 { |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8525 #ifndef __WATCOMC__ |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8526 if(strlen(path) > 2) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8527 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8528 if(path[1] == ':') |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8529 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8530 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
|
8531 _chdrive((drive - 'A')+1); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8532 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8533 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8534 #endif |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8535 return chdir(path); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8536 } |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8537 |
3 | 8538 /* |
8539 * Execute and external program in a seperate session. | |
8540 * Parameters: | |
8541 * program: Program name with optional path. | |
8542 * type: Either DW_EXEC_CON or DW_EXEC_GUI. | |
8543 * params: An array of pointers to string arguements. | |
8544 * Returns: | |
8545 * -1 on error. | |
8546 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8547 int API dw_exec(char *program, int type, char **params) |
3 | 8548 { |
475
1547e8c327d9
Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents:
470
diff
changeset
|
8549 type = type; /* keep compiler happy */ |
55
b6948eac375a
Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
54
diff
changeset
|
8550 return spawnvp(P_NOWAIT, program, (const char **)params); |
3 | 8551 } |
8552 | |
8553 /* | |
8554 * Loads a web browser pointed at the given URL. | |
8555 * Parameters: | |
8556 * url: Uniform resource locator. | |
8557 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8558 int API dw_browse(char *url) |
3 | 8559 { |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8560 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
|
8561 int len, ret; |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8562 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8563 olddir = _getcwd(NULL, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8564 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8565 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8566 "DefaultWorkingDir", NULL, browser, 1024); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8567 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8568 if(browser[0]) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8569 _SetPath(browser); |
3 | 8570 |
8571 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", | |
8572 "DefaultBrowserExe", NULL, browser, 1024); | |
8573 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8574 len = strlen(browser) - strlen("explore.exe"); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8575 |
3 | 8576 execargs[0] = browser; |
8577 execargs[1] = url; | |
8578 execargs[2] = NULL; | |
8579 | |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8580 /* 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
|
8581 * 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
|
8582 */ |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8583 if(len > 0) |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8584 { |
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
|
8585 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
|
8586 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8587 int newlen, z; |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8588 newurl = malloc(strlen(url) + 2); |
20
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8589 sprintf(newurl, "file:///%s", &url[7]); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8590 newlen = strlen(newurl); |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8591 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
|
8592 { |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8593 if(newurl[z] == '|') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8594 newurl[z] = ':'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8595 if(newurl[z] == '/') |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8596 newurl[z] = '\\'; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8597 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8598 execargs[1] = newurl; |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8599 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8600 } |
38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
18
diff
changeset
|
8601 |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8602 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
|
8603 |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8604 if(olddir) |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8605 { |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8606 _SetPath(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8607 free(olddir); |
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8608 } |
172
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8609 if(newurl) |
0fc45e386376
Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
171
diff
changeset
|
8610 free(newurl); |
170
ee6858b7d1c3
Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
169
diff
changeset
|
8611 return ret; |
3 | 8612 } |
8613 | |
8614 /* | |
8615 * Returns a pointer to a static buffer which containes the | |
8616 * current user directory. Or the root directory (C:\ on | |
8617 * OS/2 and Windows). | |
8618 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8619 char * API dw_user_dir(void) |
3 | 8620 { |
8621 static char _user_dir[1024] = ""; | |
8622 | |
8623 if(!_user_dir[0]) | |
8624 { | |
8625 char *home = getenv("HOME"); | |
8626 | |
8627 if(home) | |
8628 strcpy(_user_dir, home); | |
8629 else | |
8630 strcpy(_user_dir, "C:\\"); | |
8631 } | |
8632 return _user_dir; | |
8633 } | |
8634 | |
8635 /* | |
8636 * Call a function from the window (widget)'s context. | |
8637 * Parameters: | |
8638 * handle: Window handle of the widget. | |
8639 * function: Function pointer to be called. | |
8640 * data: Pointer to the data to be passed to the function. | |
8641 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8642 void API dw_window_function(HWND handle, void *function, void *data) |
3 | 8643 { |
8644 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data); | |
8645 } | |
8646 | |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8647 /* 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
|
8648 * 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
|
8649 * 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
|
8650 */ |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8651 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
|
8652 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8653 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
|
8654 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8655 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
|
8656 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8657 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
|
8658 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
|
8659 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
|
8660 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8661 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
|
8662 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8663 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8664 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
|
8665 { |
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8666 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
|
8667 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8668 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
|
8669 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8670 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
|
8671 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
|
8672 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8673 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8674 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8675 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
|
8676 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
|
8677 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8678 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
|
8679 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
|
8680 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8681 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
|
8682 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8683 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
|
8684 *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
|
8685 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8686 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8687 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
|
8688 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
|
8689 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8690 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
|
8691 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
|
8692 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8693 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
|
8694 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
|
8695 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8696 *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
|
8697 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8698 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
|
8699 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8700 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8701 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
|
8702 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8703 |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8704 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
|
8705 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8706 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
|
8707 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8708 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
|
8709 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8710 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
|
8711 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8712 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
|
8713 { |
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
|
8714 *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
|
8715 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
|
8716 free(tmp); |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8717 if(!all) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8718 return 0; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8719 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
|
8720 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8721 else |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8722 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8723 /* If all is true we should |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8724 * never get here. |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8725 */ |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8726 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
|
8727 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
|
8728 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
|
8729 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
|
8730 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8731 } |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8732 else |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8733 { |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8734 prev = tmp; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8735 tmp = tmp->next; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8736 } |
90
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8737 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8738 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
|
8739 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8740 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8741 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8742 * 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
|
8743 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8744 * 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
|
8745 * 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
|
8746 * 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
|
8747 */ |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8748 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
|
8749 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8750 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
|
8751 |
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
|
8752 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
|
8753 { |
180
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8754 if(!dataname) |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8755 return; |
4207e64d4689
Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
178
diff
changeset
|
8756 |
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
|
8757 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
|
8758 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
|
8759 } |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8760 |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8761 if(data) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8762 _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
|
8763 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
|
8764 { |
d785ee5adf02
Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
116
diff
changeset
|
8765 if(dataname) |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8766 _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
|
8767 else |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8768 _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
|
8769 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8770 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8771 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8772 /* |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8773 * 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
|
8774 * Parameters: |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8775 * 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
|
8776 * 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
|
8777 * 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
|
8778 */ |
507
c607eb385e58
Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
503
diff
changeset
|
8779 void * API dw_window_get_data(HWND window, char *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
|
8780 { |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8781 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
|
8782 |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8783 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
|
8784 { |
159
9c0f1f04f4c7
Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
157
diff
changeset
|
8785 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
|
8786 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
|
8787 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
|
8788 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8789 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
|
8790 } |
eeb98f881663
Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
72
diff
changeset
|
8791 |
3 | 8792 /* |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8793 * 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
|
8794 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8795 * 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
|
8796 * 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
|
8797 * 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
|
8798 * Returns: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8799 * 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
|
8800 */ |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8801 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
|
8802 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8803 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
|
8804 { |
289
0e6f09149eaa
Fixed some EMX warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
283
diff
changeset
|
8805 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
|
8806 |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8807 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
|
8808 { |
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8809 _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
|
8810 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
|
8811 } |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8812 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8813 return 0; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8814 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8815 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8816 /* |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8817 * Removes timer callback. |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8818 * Parameters: |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8819 * 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
|
8820 */ |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8821 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
|
8822 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8823 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
|
8824 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8825 /* 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
|
8826 if(!id) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8827 return; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8828 |
199
b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
195
diff
changeset
|
8829 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
|
8830 |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8831 while(tmp) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8832 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8833 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
|
8834 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8835 if(prev) |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8836 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8837 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
|
8838 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8839 tmp = prev->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8840 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8841 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8842 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8843 Root = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8844 free(tmp); |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8845 tmp = Root; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8846 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8847 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8848 else |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8849 { |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8850 prev = tmp; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8851 tmp = tmp->next; |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8852 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8853 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8854 } |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8855 |
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
8856 /* |
3 | 8857 * Add a callback to a window event. |
8858 * Parameters: | |
8859 * window: Window handle of signal to be called back. | |
8860 * signame: A string pointer identifying which signal to be hooked. | |
8861 * sigfunc: The pointer to the function to be used as the callback. | |
8862 * data: User data to be passed to the handler function. | |
8863 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8864 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data) |
3 | 8865 { |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8866 ULONG message = 0, id = 0; |
3 | 8867 |
8868 if(window && signame && sigfunc) | |
8869 { | |
8870 if((message = _findsigmessage(signame)) != 0) | |
465
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8871 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8872 /* Handle special case of the menu item */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8873 if(message == WM_COMMAND && window < 65536) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8874 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8875 char buffer[15]; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8876 HWND owner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8877 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8878 sprintf(buffer, "_dw_id%d", (int)window); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8879 owner = (HWND)dw_window_get_data(hwndApp, buffer); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8880 |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8881 if(owner) |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8882 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8883 id = window; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8884 window = owner; |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8885 dw_window_set_data(hwndApp, buffer, 0); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8886 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8887 else |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8888 { |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8889 /* If it is a popup menu clear all entries */ |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8890 dw_signal_disconnect_by_window(window); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8891 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8892 } |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8893 _new_signal(message, window, id, sigfunc, data); |
4ff2c7210973
Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
462
diff
changeset
|
8894 } |
3 | 8895 } |
8896 } | |
8897 | |
8898 /* | |
8899 * Removes callbacks for a given window with given name. | |
8900 * Parameters: | |
8901 * window: Window handle of callback to be removed. | |
8902 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8903 void API dw_signal_disconnect_by_name(HWND window, char *signame) |
3 | 8904 { |
8905 SignalHandler *prev = NULL, *tmp = Root; | |
8906 ULONG message; | |
8907 | |
8908 if(!window || !signame || (message = _findsigmessage(signame)) == 0) | |
8909 return; | |
8910 | |
8911 while(tmp) | |
8912 { | |
8913 if(tmp->window == window && tmp->message == message) | |
8914 { | |
8915 if(prev) | |
8916 { | |
8917 prev->next = tmp->next; | |
8918 free(tmp); | |
8919 tmp = prev->next; | |
8920 } | |
8921 else | |
8922 { | |
8923 Root = tmp->next; | |
8924 free(tmp); | |
8925 tmp = Root; | |
8926 } | |
8927 } | |
8928 else | |
8929 { | |
8930 prev = tmp; | |
8931 tmp = tmp->next; | |
8932 } | |
8933 } | |
8934 } | |
8935 | |
8936 /* | |
8937 * Removes all callbacks for a given window. | |
8938 * Parameters: | |
8939 * window: Window handle of callback to be removed. | |
8940 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8941 void API dw_signal_disconnect_by_window(HWND window) |
3 | 8942 { |
8943 SignalHandler *prev = NULL, *tmp = Root; | |
8944 | |
8945 while(tmp) | |
8946 { | |
8947 if(tmp->window == window) | |
8948 { | |
8949 if(prev) | |
8950 { | |
8951 prev->next = tmp->next; | |
8952 free(tmp); | |
8953 tmp = prev->next; | |
8954 } | |
8955 else | |
8956 { | |
8957 Root = tmp->next; | |
8958 free(tmp); | |
8959 tmp = Root; | |
8960 } | |
8961 } | |
8962 else | |
8963 { | |
8964 prev = tmp; | |
8965 tmp = tmp->next; | |
8966 } | |
8967 } | |
8968 } | |
8969 | |
8970 /* | |
8971 * Removes all callbacks for a given window with specified data. | |
8972 * Parameters: | |
8973 * window: Window handle of callback to be removed. | |
8974 * data: Pointer to the data to be compared against. | |
8975 */ | |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
172
diff
changeset
|
8976 void API dw_signal_disconnect_by_data(HWND window, void *data) |
3 | 8977 { |
8978 SignalHandler *prev = NULL, *tmp = Root; | |
8979 | |
8980 while(tmp) | |
8981 { | |
8982 if(tmp->window == window && tmp->data == data) | |
8983 { | |
8984 if(prev) | |
8985 { | |
8986 prev->next = tmp->next; | |
8987 free(tmp); | |
8988 tmp = prev->next; | |
8989 } | |
8990 else | |
8991 { | |
8992 Root = tmp->next; | |
8993 free(tmp); | |
8994 tmp = Root; | |
8995 } | |
8996 } | |
8997 else | |
8998 { | |
8999 prev = tmp; | |
9000 tmp = tmp->next; | |
9001 } | |
9002 } | |
9003 } | |
9004 | |
195
b023d363fc09
Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
192
diff
changeset
|
9005 |