annotate os2/dw.c @ 337:e9a424e641ff

Some pointer changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 10 Apr 2003 12:33:29 +0000
parents a2f72b5d5d0a
children 4029240b5e63
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2 * Dynamic Windows:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3 * A GTK like implementation of the PM GUI
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4 *
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
5 * (C) 2000-2003 Brian Smith <dbsoft@technologist.com>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6 * (C) 2000 Achim Hasenmueller <achimha@innotek.de>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7 * (C) 2000 Peter Nielsen <peter@pmview.com>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8 * (C) 1998 Sergey I. Yevtushenko (some code borrowed from cell toolkit)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11 #define INCL_DOS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12 #define INCL_DOSERRORS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
13 #define INCL_WIN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
14 #define INCL_GPI
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
15
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
16 #include <os2.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
17 #include <stdlib.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
18 #include <string.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
19 #include <stdio.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
20 #include <stdarg.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
21 #include <stddef.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
22 #include <ctype.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
23 #include <process.h>
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
24 #include <time.h>
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
25 #include <io.h>
171
b8e93557b2c7 EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 170
diff changeset
26 #ifndef __EMX__
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
27 #include <direct.h>
171
b8e93557b2c7 EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 170
diff changeset
28 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
29 #include "dw.h"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
30
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
31 #define QWP_USER 0
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
32
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
33 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
34 void _do_resize(Box *thisbox, int x, int y);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
35 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
36
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
37 char ClassName[] = "dynamicwindows";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
38 char SplitbarClassName[] = "dwsplitbar";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
39 char DefaultFont[] = "9.WarpSans";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
40
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
41 HAB dwhab = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
42 HMQ dwhmq = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
43 DWTID _dwtid = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
44 LONG _foreground = 0xAAAAAA, _background = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
45
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
46 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
47 PRECORDCORE pCore = NULL, pCoreEmph = NULL;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
48 ULONG aulBuffer[4];
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
49 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
50
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
51 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
52 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
53 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
54 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
55 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
56 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
57 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
58 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
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 };
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
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
70 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
71
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
72 #ifndef min
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
73 #define min(a, b) (((a < b) ? a : b))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
74 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
75
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
76 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
77 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
78 struct _sighandler *next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
79 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
80 HWND window;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
81 int id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
82 void *signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
83 void *data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
84
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
85 } SignalHandler;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
86
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
87 SignalHandler *Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
88
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
89 typedef struct
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
90 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
91 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
92 char name[30];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
93
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
94 } SignalList;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
95
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
96 /* List of signals and their equivilent OS/2 message */
307
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
97 #define SIGNALMAX 14
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
98
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
99 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
100 { 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
101 { 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
102 { 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
103 { 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
104 { 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
105 { 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
106 { 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
107 { 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
108 { 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
109 { 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
110 { 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
111 { 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
112 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
113 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
114 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
115
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
116 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
117 */
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
118 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
119 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
120 SignalHandler *new = malloc(sizeof(SignalHandler));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
121
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
122 if(message == WM_COMMAND)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
123 dw_signal_disconnect_by_window(window);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
124
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
125 new->message = message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
126 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
127 new->id = id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
128 new->signalfunction = signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
129 new->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
130 new->next = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
131
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
132 if (!Root)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
133 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
134 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
135 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
136 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
137 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
138 {
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
139 if(tmp->message == message &&
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
140 tmp->window == window &&
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
141 tmp->signalfunction == signalfunction)
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
142 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
143 tmp->data = data;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
144 free(new);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
145 return;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
146 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
147 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
148 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
150 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
151 prev->next = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
152 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
153 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
154 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
155 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
156
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
157 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
158 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
159 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
160 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
161
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
162 for(z=0;z<SIGNALMAX;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
163 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
164 if(stricmp(signame, SignalTranslate[z].name) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
165 return SignalTranslate[z].message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
166 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
167 return 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
168 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
169
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
170 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
171 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
172 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
173 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
174 PVOID user;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
175
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
176 } 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
177
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
178
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
179 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
180 {
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
181 return TRUE;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
182 }
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
183
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
184 /* 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
185 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
186 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
187 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
188
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
189 /* Find the toplevel window */
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
190 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
191 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
192 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
193 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
194 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
195 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
196 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
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
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
199
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
200 /* Return the entryfield child of a window */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
201 HWND _find_entryfield(HWND handle)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
202 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
203 HENUM henum;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
204 HWND child, entry = 0;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
205
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
206 henum = WinBeginEnumWindows(handle);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
207 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
208 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
209 char tmpbuf[100];
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
210
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
211 WinQueryClassName(child, 99, tmpbuf);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
212
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
213 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
214 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
215 entry = child;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
216 break;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
217 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
218 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
219 WinEndEnumWindows(henum);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
220 return entry;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
221 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
222
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
223 /* 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
224 * 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
225 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
226 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
227 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
228 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
229 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
230
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
231 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
232 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
233 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
234 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
235
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
236 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
237
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
238 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
239 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
240 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
241 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
242
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
243 _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
244 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
245 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
246 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
247 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
248
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
249 /* 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
250 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
251 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
252 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
253 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
254 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc");
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
255
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
256 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
257 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
258 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
259 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
260 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
261 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
262
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
263 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
264 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
265
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
266 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
267 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
268
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
269 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
270
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
271 /* This function removes and handlers on windows and frees
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
272 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
273 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
274 void _free_window_memory(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
275 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
276 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
277 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
278 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
279
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
280 dw_signal_disconnect_by_window(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
281
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
282 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
283 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
284 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
285
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
286 if(box)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
287 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
288 if(box->count && box->items)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
289 free(box->items);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
290
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
291 WinSetWindowPtr(child, QWP_USER, 0);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
292 free(box);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
293 }
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
294 }
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
295
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
296 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
297 {
169
b2211123274e Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 167
diff changeset
298 WindowData *wd = (WindowData *)ptr;
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
299 char tmpbuf[100];
235
69f2a59ec7d0 Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 230
diff changeset
300
69f2a59ec7d0 Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 230
diff changeset
301 /* 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
302 _free_bitmap(handle);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
303
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
304 WinQueryClassName(handle, 99, tmpbuf);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
305
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
306 if(strncmp(tmpbuf, "#1", 3)==0)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
307 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
308 Box *box = (Box *)ptr;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
309
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
310 if(box->count && box->items)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
311 free(box->items);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
312 }
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
313 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
314 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
315 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
316
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
317 if(data)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
318 free(data);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
319 }
290
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
320 else if(strncmp(tmpbuf, "#37", 4)==0)
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
321 dw_container_clear(handle, FALSE);
169
b2211123274e Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 167
diff changeset
322
b2211123274e Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 167
diff changeset
323 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
324 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
325
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
326 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
327 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
328 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
329 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
330
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
331 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
332 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
333 _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
334
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
335 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
336 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
337 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
339 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
340 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
341 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
342 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
343 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
344 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
345
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
346 if(!handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
347 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
348
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
349 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
350 return 0;
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
351
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
352 WinQueryClassName(handle, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
353
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
354 /* These are the window classes which can
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
355 * obtain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
356 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
365 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
366 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
367 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
368
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
369 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
370 {
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
371 int z, n;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
372 static HWND lasthwnd, firsthwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
373 static int finish_searching;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
374
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
375 /* Start is 2 when we have cycled completely and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
376 * need to set the focus to the last widget we found
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
377 * that was valid.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
378 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
379 if(start == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
380 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
381 if(lasthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
382 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
383 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
384 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
385
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
386 /* Start is 1 when we are entering the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
387 * for the first time, it is zero when entering
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
388 * the function recursively.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
389 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
390 if(start == 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
391 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
392 lasthwnd = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
393 finish_searching = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
394 firsthwnd = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
395 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
396
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
397 for(n=0;n<box->count;n++)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
398 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
399 /* Vertical boxes are inverted on OS/2 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
400 if(box->type == DW_VERT)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
401 z = n;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
402 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
403 z = box->count - n - 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
404
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
405 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
406 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
407 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
408
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
409 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
410 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
411 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
412 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
413 {
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
414 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
415 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
416 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
417 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
418 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
419 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
420 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
421 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
422
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
423 /* 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
424 * 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
425 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
426 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
427 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
428 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
429 if(_validate_focus(box->items[z].hwnd))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
430 {
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
431 /* 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
432 * 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
433 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
434 if(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
435 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
436 if(!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
437 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
438 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
439 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
440 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
441 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
442
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
443 if(!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
444 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
445
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
446 lasthwnd = box->items[z].hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
447 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
448 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
449 {
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
450 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
451
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
452 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
453 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
454 {
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
455 /* 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
456 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
457
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
458 if(mybox)
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
459 {
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
460 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
461
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
462 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
463 return 1;
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
464 }
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
465
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
466 /* 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
467 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
468
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
469 if(mybox)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
470 {
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
471 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
472
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
473 if(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
474 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
475 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
476 }
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
477 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
478 {
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
479 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
480 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
481 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
482
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
483 if(page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
484 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
485 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
486
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
487 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
488 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
489 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
490 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
491 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
492 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
493 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
494 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
495 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
496
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
497 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
498 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
499 int z, n;
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
500 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
501 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
502
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
503 /* 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
504 * 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
505 * 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
506 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
507 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
508 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
509 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
510 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
511 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
512 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
513
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
514 /* 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
515 * 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
516 * 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
517 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
518 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
519 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
520 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
521 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
522 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
523 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
524
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
525 for(n=0;n<box->count;n++)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
526 {
54aafc134652 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 /* Vertical boxes are inverted on OS/2 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
528 if(box->type == DW_VERT)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
529 z = box->count - n - 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
530 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
531 z = n;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
532
54aafc134652 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 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
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 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
536
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
537 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
538 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
539 }
54aafc134652 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 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
541 {
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
542 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
543 {
54aafc134652 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 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
545 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
546 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
547 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
548 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
549 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
550
54aafc134652 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 /* 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
552 * 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
553 */
54aafc134652 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 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
555 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
556 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
557 if(_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
558 {
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
559 /* 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
560 * 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
561 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
562 if(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
563 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
564 if(!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
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 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
567 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
568 }
54aafc134652 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
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
571 if(!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
572 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
573
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
574 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
575 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
576 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
577 {
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
578 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
579
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
580 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
581 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
582 {
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
583 /* 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
584 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
585
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
586 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
587 {
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
588 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
589
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
590 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
591 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
592 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
593
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
594 /* 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
595 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
596
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
597 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
598 {
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
599 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
600
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
601 if(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
602 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
603 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
604 }
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
605 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
606 {
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
607 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
608 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
609 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
610
54aafc134652 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 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
612 {
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
613 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
614
54aafc134652 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 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
616 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
617 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
618 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
619 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
620 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
621 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
622 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
623 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
624
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
625 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
626 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
627 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
628 int _initial_focus(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
629 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
630 Box *thisbox = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
631 HWND box;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
632
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
633 box = WinWindowFromID(handle, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
634 if(box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
635 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
636 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
637 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
638
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
639 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
640 _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
641 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
642 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
643
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
644 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
645 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
646 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
647 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
648 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
649 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
650 HWND box, lastbox = _toplevel_window(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
651
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
652 box = WinWindowFromID(lastbox, FID_CLIENT);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
653 if(box)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
654 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
655 else
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
656 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
657
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
658 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
659 {
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
660 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
661 _focus_check_box(thisbox, handle, 2, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
662 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
663 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
664
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
665 /* 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
666 * 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
667 */
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 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
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 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
671 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
672
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
673 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
674 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
675 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
676 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
677 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
678
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
679 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
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 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
682 _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
683 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
684 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
685
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
686 /* This function will recursively search a box and add up the total height of it */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
687 void _count_size(HWND box, int type, int *xsize, int *xorigsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
688 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
689 int size = 0, origsize = 0, z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
690 Box *tmp = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
691
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
692 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
693 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
694 *xsize = *xorigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
695 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
696 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
697
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
698 if(type == tmp->type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
699 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
700 /* If the box is going in the direction we want, then we
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
701 * return the entire sum of the items.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
702 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
703 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
704 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
705 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
706 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
707 int s, os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
708
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
709 _count_size(tmp->items[z].hwnd, type, &s, &os);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
710 size += s;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
711 origsize += os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
712 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
713 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
714 {
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
715 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
716 origsize += (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
717 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
718 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
719 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
720 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
721 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
722 /* If the box is not going in the direction we want, then we only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
723 * want to return the maximum value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
724 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
725 int tmpsize = 0, tmporigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
726
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
727 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
728 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
729 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
730 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
731 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
732 {
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
733 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
734 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
735 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
736
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
737 if(tmpsize > size)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
738 size = tmpsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
739 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
740 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
741
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
742 *xsize = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
743 *xorigsize = origsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
744 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
745
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
746
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
747 /* Function: TrackRectangle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
748 * Abstract: Tracks given rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
749 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
750 * If rclBounds is NULL, then track rectangle on entire desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
751 * rclTrack is in window coorditates and will be mapped to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
752 * desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
753 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
754
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
755 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
756 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
757 TRACKINFO track;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
758 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
759
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
760 track.cxBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
761 track.cyBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
762 track.cxGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
763 track.cyGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
764 track.cxKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
765 track.cyKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
766
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
767 if(!rclTrack)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
768 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
769
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
770 if(rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
771 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
772 track.rclBoundary = *rclBounds;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
773 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
774 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
775 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
776 track.rclBoundary.yTop =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
777 track.rclBoundary.xRight = 3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
778 track.rclBoundary.yBottom =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
779 track.rclBoundary.xLeft = -3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
780 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
781
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
782 track.rclTrack = *rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
783
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
784 WinMapWindowPoints(hwndBase,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
785 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
786 (PPOINTL)&track.rclTrack,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
787 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
788
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
789 track.ptlMinTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
790 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
791 track.ptlMinTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
792 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
793 track.ptlMaxTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
794 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
795 track.ptlMaxTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
796 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
797
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
798 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
799
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
800 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
801
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
802 if(rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
803 *rclTrack = track.rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
804
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
805 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
806 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
807
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
808 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
809 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
810 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
811
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
812 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
813
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
814 /* 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
815 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
816 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
817 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
818 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
819
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
820 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
821 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
822 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
823 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
824
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
825 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
826 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
827 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
828 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
829
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
830 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
831 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
832 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
833 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
834
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
835 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
836
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
837 _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
838 }
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 128
diff changeset
839 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
840 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
841
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
842 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
843 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
844
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
845 /* 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
846 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
847 {
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
848 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
849 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
850 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
851 }
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
852
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
853 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
854 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
855 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
856 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
857 int pass, int *usedpadx, int *usedpady)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
858 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
859 int z, currentx = 0, currenty = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
860 int uymax = 0, uxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
861 int upymax = 0, upxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
862 /* Used for the SIZEEXPAND */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
863 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
864 int nupx = *usedpadx, nupy = *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
865
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
866 (*usedx) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
867 (*usedy) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
868
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
869 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
870 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
871 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
872 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
873 int initialx, initialy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
874 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
875
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
876 initialx = x - (*usedx);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
877 initialy = y - (*usedy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
878
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
879 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
880 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
881 int newx, newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
882 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
883 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
884
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
885 /* On the second pass we know how big the box needs to be and how
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
886 * much space we have, so we can calculate a ratio for the new box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
887 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
888 if(pass == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
889 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
890 int deep = *depth + 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
891
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
892 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
893
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
894 tmp->upx = upx - *usedpadx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
895 tmp->upy = upy - *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
896
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
897 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
898 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
899
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
900 tmp->width = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
901 tmp->height = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
902
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
903 tmp->parentxratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
904 tmp->parentyratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
905
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
906 tmp->parentpad = tmp->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
907
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
908 /* Just in case */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
909 tmp->xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
910 tmp->yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
911
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
912 if(thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
913 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
914 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
915 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
916 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
917 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
918 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
919 if((thisbox->items[z].width-tmp->upx)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
920 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
921 }
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
922 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
923 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
924 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
925 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
926 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
927 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
928 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
929 if((thisbox->items[z].height-tmp->upy)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
930 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
931 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
932
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
933 nux = *usedx; nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
934 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
935 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
936
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
937 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
938
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
939 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
940
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
941 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
942
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
943 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
944 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
945
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
946 tmp->minwidth = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
947 tmp->minheight = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
948 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
949 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
950
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
951 if(pass > 1 && *depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
952 {
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
953 if(thisbox->type == DW_VERT)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
954 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
955 if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
956 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
957 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
958 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
959 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
960 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
961 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
962 if(thisbox->minwidth-thisbox->upx == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
963 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
964 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
965 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
966 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
967
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
968 if(thisbox->type == DW_HORZ)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
969 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
970 if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
971 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
972 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
973 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
974 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
975 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
976 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
977 if(thisbox->minheight-thisbox->upy == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
978 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
979 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
980 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
981 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
982
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
983 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
984 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
985 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
986
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
987 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
988 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
989 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
990 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
991 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
992 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
993 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
994 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
995 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
996 thisbox->items[z].xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
997 thisbox->items[z].yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
998 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
999
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
1000 if(thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1001 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1002 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1003 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1004 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1005 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1006 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1007 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1008 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1009 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1010 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1011 if(thisbox->items[z].pad*2 > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1012 upxmax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1013 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1014 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1015 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1016 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1017 if(thisbox->items[z].width == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1018 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1019 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1020 /* thisbox->items[z].width = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1021 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1022 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1023 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1024 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1025 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1026 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1027 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1028 (*usedpadx) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1029 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1030 }
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
1031 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1032 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1033 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1034 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1035 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1036 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1037 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1038 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1039 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1040 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1041 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1042 if(thisbox->items[z].pad*2 > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1043 upymax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1044 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1045 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1046 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1047 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1048 if(thisbox->items[z].height == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1049 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1050 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1051 /* thisbox->items[z].height = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1052 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1053 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1054 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1055 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1056 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1057 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1058 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1059 (*usedpady) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1060 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1061 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1062 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1063
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1064 (*usedx) += uxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1065 (*usedy) += uymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1066 (*usedpadx) += upxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1067 (*usedpady) += upymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1068
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1069 currentx += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1070 currenty += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1071
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1072 /* The second pass is for expansion and actual placement. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1073 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1074 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1075 /* Any SIZEEXPAND items should be set to uxmax/uymax */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1076 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1077 {
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
1078 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1079 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
1080 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1081 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1082 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1083 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1084 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1085 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1086
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1087 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1088 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1089 if(*depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1090 {
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
1091 if(thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1092 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1093 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1094 tmp->width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1095 }
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
1096 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1097 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1098 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1099 tmp->height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1100 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1101 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1102
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1103 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1104
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1105 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1106
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1107 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1108
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1109 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1110 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1111 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1112
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1113 for(z=0;z<(thisbox->count);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1114 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1115 int height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1116 int width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1117 int pad = thisbox->items[z].pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1118 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
1119 int vectorx, vectory;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1120
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1121 /* When upxmax != pad*2 then ratios are incorrect. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1122 vectorx = (int)((width*thisbox->items[z].xratio)-width);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1123 vectory = (int)((height*thisbox->items[z].yratio)-height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1124
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1125 if(width > 0 && height > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1126 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1127 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1128 /* This is a hack to fix rounding of the sizing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1129 if(*depth == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1130 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1131 vectorx++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1132 vectory++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1133 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1134
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1135 /* If this item isn't going to expand... reset the vectors to 0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1136 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1137 vectory = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1138 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1139 vectorx = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1140
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1141 WinQueryClassName(handle, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1142
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
1143 if(strncmp(tmpbuf, "#2", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1144 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1145 /* Make the combobox big enough to drop down. :) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1146 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1147 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1148 }
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
1149 else if(strncmp(tmpbuf, "#6", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1150 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1151 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1152 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1153 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1154 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1155 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
1156 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1157 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1158 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
1159 _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
1160 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1161 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
1162 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1163 /* 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
1164 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
1165 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
1166 int cx = width + vectorx;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1167 int cy = height + vectory;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1168
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1169 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1170 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
1171
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1172 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
1173 _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
1174 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1175 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1176 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1177 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1178 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1179 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1180 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1181 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1182
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1183 if(boxinfo && boxinfo->grouphwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1184 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
1185 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1186
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1187 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1188
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1189 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1190
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
1191 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1192 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
1193 if(thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1194 currenty += height + vectory + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1195 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1196 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1197 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1198 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1199 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1200
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1201 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1202 {
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
1203 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
1204 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1205 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1206 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1207 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1208
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1209 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1210
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1211 if(usedx-usedpadx == 0 || usedy-usedpady == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1212 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1213
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1214 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1215 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1216
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1217 usedx = usedy = usedpadx = usedpady = depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1218
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1219 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1220 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1221 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1222 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1223
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1224 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1225 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1226 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1227 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
1228 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
1229 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
1230
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1231 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
1232 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
1233 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
1234
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1235 if(thisbox && !thisbox->titlebar)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1236 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1237 switch(msg)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1238 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1239 case WM_QUERYTRACKINFO:
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1240 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1241 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
1242 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1243 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
1244 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
1245 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
1246 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
1247
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1248 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
1249
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1250 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
1251 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
1252
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1253 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
1254 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1255 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1256 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1257 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1258
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1259 if(blah && *blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1260 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1261 PFNWP myfunc = *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1262 return myfunc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1263 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1264
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1265 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1266 }
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1267
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1268 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
1269 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1270 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
1271
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1272 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
1273 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
1274 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
1275 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
1276 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
1277 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1278
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1279 /* 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
1280 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
1281 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1282 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
1283
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1284 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
1285 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
1286 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
1287 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
1288 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
1289 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1290
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1291 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
1292 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1293 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
1294
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1295 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
1296 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
1297 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
1298 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
1299 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
1300 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1301
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1302 /* 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
1303 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
1304 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1305 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
1306
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1307 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
1308 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
1309 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
1310 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
1311 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
1312 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1313
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1314 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1315 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
1316 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1317 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1318
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1319 if(blah && *blah)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1320 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1321 PFNWP myfunc = *blah;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1322
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1323 switch(msg)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1324 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1325 case WM_PAINT:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1326 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1327 HPS hpsPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1328 RECTL rclPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1329 char buf[1024];
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1330
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1331 hpsPaint = WinBeginPaint(hWnd, 0, 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1332 WinQueryWindowRect(hWnd, &rclPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1333 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1334
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1335 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
1336 _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
1337 _Left(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1338
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1339 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
1340 _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
1341 _Bottom(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1342
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1343 WinQueryWindowText(hWnd, 1024, buf);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1344 rclPaint.xLeft += 3;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1345 rclPaint.xRight--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1346 rclPaint.yTop--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1347 rclPaint.yBottom++;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1348
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1349 GpiSetColor(hpsPaint, CLR_BLACK);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1350 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
1351 WinEndPaint(hpsPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1352
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1353 return (MRESULT)TRUE;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1354 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1355 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1356 return myfunc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1357 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1358
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1359 return WinDefWindowProc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1360 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1361
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1362 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
1363 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1364 char tmpbuf[100];
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1365
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1366 WinQueryClassName(handle, 99, tmpbuf);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1367
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1368 /* 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
1369 * obtain input focus.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1370 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1371 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
1372 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1373 /* 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
1374 SignalHandler *tmp = Root;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1375
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1376 /* 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
1377 while(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1378 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1379 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
1380 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1381 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
1382
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1383 /* 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
1384 if(tmp->window == handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1385 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1386 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
1387 tmp = NULL;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1388 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1389 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1390 if(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1391 tmp= tmp->next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1392 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1393 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1394 else
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1395 WinSetFocus(HWND_DESKTOP, handle);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1396 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1397
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1398 #define ENTRY_CUT 1001
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1399 #define ENTRY_COPY 1002
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1400 #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
1401 #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
1402 #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
1403
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1404 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1405 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1406 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1407 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1408 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1409 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
1410 PFNWP oldproc = 0;
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1411 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
1412
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1413 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1414 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1415
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1416 WinQueryClassName(hWnd, 99, tmpbuf);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1417
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1418 /* 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
1419 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
1420 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
1421 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
1422 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
1423 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1424 switch(msg)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1425 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1426 case WM_CONTEXTMENU:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1427 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1428 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
1429 long x, y;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1430
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1431 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
1432 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1433 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
1434 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
1435 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1436 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
1437 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
1438 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1439 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
1440 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
1441 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1442 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
1443 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
1444
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1445 WinSetFocus(HWND_DESKTOP, hWnd);
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1446 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
1447 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
1448 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1449 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1450 case WM_COMMAND:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1451 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1452 ULONG command = COMMANDMSG(&msg)->cmd;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1453
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1454 /* MLE */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1455 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
1456 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1457 switch(command)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1458 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1459 case ENTRY_CUT:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1460 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
1461 case ENTRY_COPY:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1462 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
1463 case ENTRY_PASTE:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1464 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
1465 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
1466 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
1467 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
1468 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1469 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
1470 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
1471 }
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1472 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1473 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1474 else /* Other */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1475 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1476 HWND handle = hWnd;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1477
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1478 /* 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
1479 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
1480 handle = WinWindowFromID(hWnd, 667);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1481
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1482 if(handle)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1483 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1484 switch(command)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1485 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1486 case ENTRY_CUT:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1487 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
1488 case ENTRY_COPY:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1489 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
1490 case ENTRY_PASTE:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1491 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
1492 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
1493 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1494 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
1495 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
1496 }
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1497 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1498 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1499 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1500 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1501 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1502 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1503 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1504
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1505 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1506 {
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1507 case WM_BUTTON1DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1508 case WM_BUTTON2DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1509 case WM_BUTTON3DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1510 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1511 if(strncmp(tmpbuf, "#32", 4)==0)
38
538db2a48bac Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 37
diff changeset
1512 _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
1513 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1514 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
1515 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
1516 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1517 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
1518 _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
1519 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1520 break;
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1521 case WM_SETFOCUS:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1522 _run_event(hWnd, msg, mp1, mp2);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1523 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1524 case WM_CHAR:
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1525 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
1526 return (MRESULT)TRUE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1527 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1528 {
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
1529 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
1530 _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
1531 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
1532 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1533 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1534 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1535 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
1536 _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
1537 /* 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
1538 * 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
1539 */
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1540 else if(SHORT1FROMMP(mp2) == 283)
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 128
diff changeset
1541 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
1542
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1543 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1544 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
1545 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1546 /* 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
1547 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
1548 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
1549 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1550 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1551 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
1552 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1553 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
1554 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
1555 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1556 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1557 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1558
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1559 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
1560 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
1561
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1562 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
1563 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1564
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1565 /* 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
1566 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
1567 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1568 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
1569
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1570 switch(msg)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1571 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1572 case WM_CONTEXTMENU:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1573 case WM_COMMAND:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1574 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
1575 case WM_SETFOCUS:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1576 _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
1577 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1578 case WM_CHAR:
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1579 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
1580 return (MRESULT)TRUE;
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1581 /* 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
1582 if(SHORT1FROMMP(mp2) == 283)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1583 return (MRESULT)TRUE;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1584 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1585 }
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 if(blah && blah->oldproc)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1588 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
1589
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1590 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
1591 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1592
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1593 /* 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
1594 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
1595 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1596 switch(msg)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1597 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1598 case WM_VSCROLL:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1599 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1600 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1601 USHORT pos = SHORT1FROMMP(mp2);
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 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
1604 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1605 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1606 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1607 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
1608 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1609
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1610 /* Handle special messages for the spinbutton's entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1611 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1612 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1613 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1614 PFNWP oldproc = 0;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1615
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1616 if(blah)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1617 oldproc = blah->oldproc;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1618
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1619 switch(msg)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1620 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1621 case WM_CONTEXTMENU:
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1622 case WM_COMMAND:
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1623 return _entryproc(hWnd, msg, mp1, mp2);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1624 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1625
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1626 if(oldproc)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1627 return oldproc(hWnd, msg, mp1, mp2);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1628
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1629 return WinDefWindowProc(hWnd, msg, mp1, mp2);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1630 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1631
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1632 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
1633 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1634 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value");
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1635 int range = dw_percent_query_range(hwnd);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1636 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
1637 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
1638 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
1639 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
1640 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1641
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1642 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
1643 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1644 int inew, range = dw_percent_query_range(hwnd);
116
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1645 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
1646 {
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1647 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
1648 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
1649 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
1650 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
1651 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
1652 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1653 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1654
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1655 /* 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
1656 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
1657 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1658 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
1659 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
1660
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1661 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
1662 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
1663
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1664 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
1665 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1666 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
1667 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
1668 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1669 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
1670 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1671 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1672 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1673
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1674 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1675 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1676
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1677 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1678 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1679
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1680 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1681 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1682 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1683 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1684 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1685 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
1686 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
1687
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1688 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1689 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1690
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1691 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1692 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1693 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1694 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1695 {
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
1696 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
1697 _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
1698 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
1699 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1700 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1701 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1702 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
1703 _click_default(blah->clickdefault);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1704 break;
160
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1705 case WM_BUTTON1DBLCLK:
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1706 case WM_BUTTON2DBLCLK:
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1707 case WM_BUTTON3DBLCLK:
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1708 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
1709 return (MRESULT)TRUE;
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1710 break;
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1711 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
1712 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
1713 case WM_BUTTON3DOWN:
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1714 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
1715 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
1716 _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
1717 break;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1718 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
1719 _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
1720 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1721 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1722 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1723 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1724 ULONG bcol, av[32];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1725 HPS hpsPaint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1726 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1727 unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1728
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1729 WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1730 dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1732 hpsPaint = WinGetPS(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1733 GpiSetColor(hpsPaint, CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1734
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1735 ptl.x = 0;
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1736 ptl.y = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1737 GpiMove(hpsPaint, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1738
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1739 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1740 ptl.y = height - thumbheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1741 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1742
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1743 WinReleasePS(hpsPaint);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1744 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1745 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1746 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1747 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1748 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1749
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1750 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1751 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1752
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1753 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1754 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1755 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1756 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1757 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1758
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1759 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1760 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1761 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1762 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1763 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1764 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1765 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1766
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1767 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1768 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1769 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1770 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1771 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1772
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1773 /* Returns height of specified window. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1774 int _get_height(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1775 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1776 unsigned long height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1777 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1778 return (int)height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1779 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1780
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1781 /* Find the height of the frame a desktop style window is sitting on */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1782 int _get_frame_height(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1783 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1784 while(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1785 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1786 HWND client;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1787 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1788 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1789 return _get_height(WinQueryWindow(handle, QW_PARENT));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1790 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1791 handle = WinQueryWindow(handle, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1792 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1793 return dw_screen_height();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1794 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1795
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
1796 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
1797 {
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
1798 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
1799 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
1800
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
1801 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
1802 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
1803
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
1804 pos = dw_scrollbar_query_pos(handle);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1805 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
1806
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
1807 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
1808 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
1809 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
1810
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
1811 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
1812 {
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
1813 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
1814 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
1815 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
1816 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
1817 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
1818 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
1819 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
1820 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
1821 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
1822 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
1823 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
1824 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
1825 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
1826 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
1827 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
1828 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
1829 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
1830 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
1831 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
1832 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
1833 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
1834 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
1835 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
1836 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
1837 }
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
1838 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
1839 }
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
1840
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
1841 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
1842 {
315
89eac0990c67 Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 314
diff changeset
1843 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
1844 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
1845 hwndEmph = NULLHANDLE;
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
1846 pCoreEmph = NULL;
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
1847 }
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
1848
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1849 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1850 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1851 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1852 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1853 ULONG origmsg = msg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1854
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1855 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1856 msg = WM_BUTTON1DOWN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1857 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1858 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
1859 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
1860 msg = WM_CONTROL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1861
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1862 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1863 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1864 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1865 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1866 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1867 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1868 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1869 case WM_SETFOCUS:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1870 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1871 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
1872 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
1873 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
1874
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1875 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
1876 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1877 result = setfocusfunc(tmp->window, tmp->data);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1878 tmp = NULL;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1879 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1880 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1881 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1882 break;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1883 case WM_TIMER:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1884 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1885 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
1886 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
1887 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1888 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
1889 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
1890 tmp = NULL;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1891 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1892 result = 0;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1893 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
1894 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1895 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1896 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
1897 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1898
276
dfbda83b7cad Eliminate configure event callbacks when either the width or height is 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 267
diff changeset
1899 if((hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) && SHORT1FROMMP(mp2) && SHORT2FROMMP(mp2))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1900 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1901 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1902 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1903 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1904 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1905 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1906 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1907 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1908 POINTS pts = (*((POINTS*)&mp1));
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
1909 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1910
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1911 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1912 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1913 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1914
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1915 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1916 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1917 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1918 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1919 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1920 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1921 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1922 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1923 case WM_BUTTON3DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1924 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1925 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1926 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1927
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1928 result = buttonfunc(tmp->window, pts.x, _get_frame_height(tmp->window) - pts.y, button, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1929 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1930 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1931 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1932 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1933 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1934 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1935 POINTS pts = (*((POINTS*)&mp1));
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
1936 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1937
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1938 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1939 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1940 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1941
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1942 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1943 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1944 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1945 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1946 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1947 case WM_BUTTON2UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1948 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1949 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1950 case WM_BUTTON3UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1951 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1952 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1953 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1954
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1955 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);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1956 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1957 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1958 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1959 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1960 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1961 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
1962 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1963
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1964 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1965 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1966 int keys = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1967 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1968
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1969 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1970 keys = DW_BUTTON1_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1971 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1972 keys |= DW_BUTTON2_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1973 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1974 keys |= DW_BUTTON3_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1975
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1976 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1977 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1978 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1979 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1980 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1981 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1982 {
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1983 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
1984
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
1985 if((hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1986 {
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1987 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
1988 char ch = 0;
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1989
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1990 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
1991 ch = (char)SHORT1FROMMP(mp2);
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1992 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
1993 vk = SHORT2FROMMP(mp2);
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1994 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
1995 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
1996
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1997 /* 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
1998 * up as tabs!
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
1999 */
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2000 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
2001 {
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2002 ch = 0;
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2003 vk = VK_SHIFT;
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2004 }
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2005
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2006 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
2007 SHORT1FROMMP(mp1) & (KC_ALT | KC_SHIFT | KC_CTRL), tmp->data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2008 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2009 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2010 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2011 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2012 case WM_CLOSE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2013 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2014 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2016 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2017 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2018 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
2019 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
2020 result = FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2021 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2022 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2023 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2024 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2025 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2026 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2027 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2028 DWExpose exp;
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2029 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2030 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2031
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2032 if(hWnd == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2033 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2034 int height = _get_height(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2035
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2036 hps = WinBeginPaint(hWnd, 0L, &rc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2037 exp.x = rc.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2038 exp.y = height - rc.yTop - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2039 exp.width = rc.xRight - rc. xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2040 exp.height = rc.yTop - rc.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2041 result = exposefunc(hWnd, &exp, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2042 WinEndPaint(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2043 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2044 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2045 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2046 case WM_COMMAND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2047 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2048 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2049 ULONG command = COMMANDMSG(&msg)->cmd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2050
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2051 if(tmp->window < 65536 && command == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2052 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
2053 result = clickfunc(popup ? popup : tmp->window, tmp->data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2054 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2055 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2056 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2057 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2058 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
2059 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
2060 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2061 {
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
2062 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
2063 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
2064 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
2065
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
2066 switch(svar)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2067 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2068 case CN_ENTER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2069 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2070 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2071 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2072 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2073 char *text = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2074
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2075 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2076 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2077 PRECORDCORE pre;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2078
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2079 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2080 if(pre)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2081 text = pre->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2082 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2083
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2084 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2085 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2086 result = containerselectfunc(tmp->window, text, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2087 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2088 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2089 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2090 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2091 case CN_CONTEXTMENU:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2092 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2093 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2094 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2095 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2096 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
2097 void *user = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2098 LONG x,y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2099
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2100 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2101 {
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
2102 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
2103
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2104 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
2105
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2106 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
2107 user = pci->user;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2108 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2109
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2110 dw_pointer_query_pos(&x, &y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2111
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2112 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2113 {
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
2114 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
2115
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
2116 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
2117 {
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
2118 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
2119 {
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
2120 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
2121
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
2122 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
2123 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
2124 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
2125 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
2126 _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
2127 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
2128 }
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
2129 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
2130 {
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2131 if(pCoreEmph)
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2132 _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
2133 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
2134 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
2135 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
2136 }
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
2137 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2138 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2139 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2140 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2141 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2142 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
2143 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
2144 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2145 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
2146 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
2147
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2148 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
2149 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2150 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
2151
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2152 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
2153 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2154 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
2155 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2156 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
2157
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2158 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
2159 {
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
2160 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
2161
161
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2162 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
2163 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
2164 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2165 {
161
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2166 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
2167 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2168 lasthcnr = 0;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2169 lastitem = 0;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2170 }
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2171 else
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2172 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2173 lasthcnr = tmp->window;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2174 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
2175 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
2176 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2177 }
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
2178 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
2179 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2180 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2181 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2182 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
2183 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2184 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2185 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2186 case LN_SELECT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2187 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2188 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
2189
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2190 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
2191
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2192 if(strncmp(classbuf, "#38", 4) == 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2193 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2194 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
2195
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2196 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
2197 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2198 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
2199 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
2200 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
2201 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
2202 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2203 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
2204 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
2205 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
2206 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2207 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
2208 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2209 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2210 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2211 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2212 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
2213 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
2214 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
2215 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
2216
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2217 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2218 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2219 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
2220 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
2221
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2222 dw_listbox_query_text(tmp->window, index, buf1, 500);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2223
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2224 _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
2225
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2226 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
2227 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2228 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
2229
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2230 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
2231
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2232 /* 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
2233 * 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
2234 */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2235 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
2236 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
2237
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2238 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
2239 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
2240 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2241 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2242 result = listboxselectfunc(tmp->window, index, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2243
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2244 _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
2245 tmp = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2246 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2247 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2248 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2249 break;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2250 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
2251 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2252 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
2253
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
2254 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
2255 {
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
2256 /* 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
2257 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
2258 {
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
2259 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
2260 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
2261 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
2262 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
2263 {
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
2264 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
2265 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
2266 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
2267 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
2268 }
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
2269 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
2270 }
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
2271 }
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
2272 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
2273 {
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
2274 /* 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
2275 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
2276 {
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
2277 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
2278
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
2279 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
2280 {
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
2281 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
2282 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
2283 }
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
2284 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
2285 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
2286 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2287 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2288 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2289
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2290 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2291 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2292 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2293 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2294 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2295 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2296
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2297 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2298 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2299
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2300 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2301 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2302 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2303
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2304 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2305 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2306 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2307 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2308
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2309 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2310 {
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
2311 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
2312 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
2313 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
2314 {
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
2315 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
2316 _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
2317 }
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
2318 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2319 case WM_CONTROL:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2320 _run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2321 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2322 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2323
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2324 if(blah && blah->oldproc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2325 return blah->oldproc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2326
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2327 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2328 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2329
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2330 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2331 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2332 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2333 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2334 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
2335 void (* API windowfunc)(PVOID) = 0L;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2336
150
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
2337 if(!command_active)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2338 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2339 /* Make sure we don't end up in infinite recursion */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2340 command_active = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2341
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2342 result = (int)_run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2343
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2344 command_active = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2345 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2346
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2347 /* Now that any handlers are done... do normal processing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2348 switch( msg )
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2349 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2350 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2351 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2352
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2353 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2354 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2355 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2356 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2357
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2358 hps = WinBeginPaint( hWnd, 0L, &rc );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2359 WinEndPaint( hps );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2360 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2361 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2362
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2363 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2364 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2365 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2366
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2367 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2368 return (MPARAM)TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2369
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2370 if(mybox && mybox->flags != DW_MINIMIZED)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2371 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2372 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2373 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2374 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2375 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2376
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2377 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2378
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2379 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2381 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2382 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2383 case WM_MINMAXFRAME:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2384 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2385 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2386 SWP *swp = (SWP *)mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2387
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2388 if(mybox && (swp->fl & SWP_MINIMIZE))
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2389 mybox->flags = DW_MINIMIZED;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2390
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2391 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
2392 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2393 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
2394 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2395 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
2396 }
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2397
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2398 if(mybox && (swp->fl & SWP_MAXIMIZE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2399 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2400 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
2401 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
2402
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
2403 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
2404
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
2405 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
2406 return FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2407
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2408 mybox->flags = 0;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2409
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2410 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2411 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2412 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2413 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2414
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2415 _do_resize(mybox, swp->cx, swp->cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2416
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2417 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2418 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2419 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2420
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2421 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
2422 _check_resize_notebook(mybox->items[z].hwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2423
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2424 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2425
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2426 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2427 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2428 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2429 break;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2430 case WM_CONTROL:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2431 switch(SHORT2FROMMP(mp1))
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2432 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2433 case BKN_PAGESELECTEDPENDING:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2434 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2435 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2436 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
2437 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
2438 unsigned long x, y, width, height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2439 RECTL rc;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2440
21
c6e76b796b28 Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 20
diff changeset
2441 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
2442 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2443 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
2444
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2445 rc.xLeft = x;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2446 rc.yBottom = y;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2447 rc.xRight = x + width;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2448 rc.yTop = y + height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2449
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2450 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
2451
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2452 _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
2453 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2454 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2455 break;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2456 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2457 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2458 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
2459 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
2460 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2461 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
2462 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
2463 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2464 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2465 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
2466 windowfunc = (void (* API)(void *))mp1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2467
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2468 if(windowfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2469 windowfunc((void *)mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2470 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2471 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2472 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2473 {
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
2474 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
2475 _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
2476 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
2477 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2478 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2479 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2480 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2481 case WM_DESTROY:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2482 /* Free memory before destroying */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2483 _free_window_memory(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2484 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
2485 case WM_MENUEND:
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2486 _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
2487 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2488 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2489
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2490 if(result != -1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2491 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2492 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2493 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2494 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2495
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2496 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2497 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2498 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2499
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2500 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2501 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2502 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2503 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2504 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2505 _changebox(tmp, percent, type);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2506 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2507 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2508 {
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
2509 if(type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2510 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2511 if(thisbox->items[z].hsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2512 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2513 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2514 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2515 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2516 if(thisbox->items[z].vsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2517 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2518 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2519 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2520 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2521 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2522
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2523 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
2524 {
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
2525 if(type == DW_HORZ)
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2526 {
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
2527 int newx = x;
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2528 float ratio = (float)percent/(float)100.0;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2529 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2530 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2531 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2532
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2533 WinShowWindow(handle1, FALSE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2534 WinShowWindow(handle2, FALSE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2535
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
2536 newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2537
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2538 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
2539 _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
2540
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2541 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
2542
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2543 tmp = WinQueryWindowPtr(handle2, QWP_USER);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2544
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2545 newx = x - newx - SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2546
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2547 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
2548 _do_resize(tmp, newx - 1, y - 1);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2549
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2550 WinShowWindow(handle1, TRUE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2551 WinShowWindow(handle2, TRUE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2552 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2553 else
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2554 {
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
2555 int newy = y;
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2556 float ratio = (float)percent/(float)100.0;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2557 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2558 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2559 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2560
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2561 WinShowWindow(handle1, FALSE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2562 WinShowWindow(handle2, FALSE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2563
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
2564 newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2565
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2566 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
2567 _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
2568
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2569 tmp = WinQueryWindowPtr(handle2, QWP_USER);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2570
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2571 newy = y - newy - SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2572
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2573 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
2574 _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
2575
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2576 WinShowWindow(handle1, TRUE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2577 WinShowWindow(handle2, TRUE);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2578
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2579 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
2580 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2581 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2582
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2583
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2584 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2585 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2586 {
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
2587 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
2588 int type = (int)dw_window_get_data(hwnd, "_dw_type");
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2589 int start = (int)dw_window_get_data(hwnd, "_dw_start");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2590
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2591 switch (msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2592 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2593 case WM_ACTIVATE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2594 case WM_SETFOCUS:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2595 return (MRESULT)(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2596
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2597 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2598 {
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
2599 HPS hps;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2600 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
2601 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
2602
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2603 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
2604
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
2605 WinQueryWindowRect(hwnd, &rcl);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2606
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
2607 if(type == DW_HORZ)
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2608 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2609 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
2610 ptl[0].y = rcl.yBottom;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2611 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
2612 ptl[1].y = rcl.yTop;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2613 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2614 else
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2615 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2616 ptl[0].x = rcl.xLeft;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2617 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
2618 ptl[1].x = rcl.xRight;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2619 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
2620 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2621
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
2622
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2623 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
2624 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
2625 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
2626 WinEndPaint(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2627 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2628 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2629
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2630 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2631 {
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
2632 if(type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2633 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2634 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2635 SPTR_SIZEWE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2636 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2637 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2638 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2639 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2640 SPTR_SIZENS,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2641 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2642 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2643 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2644 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2645 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2646 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2647 RECTL rclFrame;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2648 RECTL rclBounds;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2649
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2650 WinQueryWindowRect(hwnd, &rclFrame);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2651 WinQueryWindowRect(hwnd, &rclBounds);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2652
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2653 WinMapWindowPoints(hwnd, HWND_DESKTOP,
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2654 (PPOINTL)&rclBounds, 2);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2655
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2656
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
2657 if(type == DW_HORZ)
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2658 {
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2659 rclFrame.xLeft = start;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2660 rclFrame.xRight = start + SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2661 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2662 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2663 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2664 rclFrame.yBottom = start;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2665 rclFrame.yTop = start + SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2666 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2667
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2668 if(percent)
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2669 {
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2670 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2671
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2672 if(rc == TRUE)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2673 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2674 int width = (rclBounds.xRight - rclBounds.xLeft);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2675 int height = (rclBounds.yTop - rclBounds.yBottom);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2676
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
2677 if(type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2678 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2679 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
2680 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
2681 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2682 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2683 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2684 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2685 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
2686 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
2687 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2688 }
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2689 _handle_splitbar_resize(hwnd, *percent, type, width, height);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2690 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2691 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2692 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2693 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2694 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2695 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2696 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2697
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2698 /* Function: BubbleProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2699 * Abstract: Subclass procedure for bubble help
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2700 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2701 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2702 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2703 MRESULT res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2704 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2705
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2706 if(proc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2707 res = proc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2708 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2709 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2710
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2711 if(msg == WM_PAINT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2712 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2713 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2714 HPS hpsTemp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2715 RECTL rcl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2716 int height, width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2717
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2718 WinQueryWindowRect(hwnd, &rcl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2719 height = rcl.yTop - rcl.yBottom - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2720 width = rcl.xRight - rcl.xLeft - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2721
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2722 /* Draw a border around the bubble help */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2723 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
2724 GpiSetColor(hpsTemp, CLR_BLACK);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2725 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2726 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2727 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2728 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2729 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2730 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2731 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2732 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2733 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2734 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2735 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2736 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2737 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2738 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2739 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2740 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2741 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2742 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2743 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2744 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2745 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2746 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2747 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2748 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2749 return res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2750 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2751
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2752 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2753 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2754 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2755
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2756 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2757 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2758 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
2759 PFNWP oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2760
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2761 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2762
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2763 if(!bubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2764 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2765
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
2766 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
2767
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2768 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2769 {
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2770 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
2771 if(mp2)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2772 _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
2773 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2774 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2775 break;
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2776 case WM_BUTTON1DOWN:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2777 case WM_BUTTON2DOWN:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2778 case WM_BUTTON3DOWN:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2779 case WM_BUTTON1DBLCLK:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2780 case WM_BUTTON2DBLCLK:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2781 case WM_BUTTON3DBLCLK:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2782 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
2783 return (MRESULT)FALSE;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2784 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2785 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2786 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2787 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2788
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
2789 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled"))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2790 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2791 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2792 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2793 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2794 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2795 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2796 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2797 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2798 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2799 /* Due to the fact that if we run the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2800 * here, finishing actions on the button will occur
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2801 * after we run the signal handler. So we post the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2802 * message so the button can finish what it needs to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2803 * do before we run our handler.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2804 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2805 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2806 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2807 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2808 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2809 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2810 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2811 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2812 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2813 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2814 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2815 case WM_USER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2816 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2817 SignalHandler *tmp = (SignalHandler *)mp1;
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2818 int (* API clickfunc)(HWND, void *) = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2819
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2820 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2821 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2822 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2823
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2824 clickfunc(tmp->window, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2825 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2826 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2827 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2828 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2829 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2830 /* A button press should also occur for an ENTER or SPACE press
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2831 * while the button has the active input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2832 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2833 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2834 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2835 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2836
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2837 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2838 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2839 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2840 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2841 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2842 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2843 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2844 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2845 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2846 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2847 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2848 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2849 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2850 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2851 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2852 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2853 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2854 {
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
2855 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
2856 _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
2857 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
2858 _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
2859 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
2860 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
2861 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2862 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
2863 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2864 _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
2865 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
2866 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2867 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
2868 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2869 _shift_focus(hwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2870 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2871 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2872 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2873 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2874 case 0x041f:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2875 if (hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2876 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2877 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2878 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2879 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2880 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2881
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2882 case 0x041e:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2883
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2884 if(!*bubble->bubbletext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2885 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2886
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2887 if(hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2888 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2889 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2890 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2891 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2892
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2893 if(!hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2894 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2895 HPS hpsTemp = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2896 LONG lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2897 LONG lWidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2898 POINTL txtPointl[TXTBOX_COUNT];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2899 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
2900 ULONG ulColor = CLR_YELLOW;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2901 void *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2902
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2903 hwndBubbleLast = hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2904 hwndBubble = WinCreateWindow(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2905 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2906 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2907 SS_TEXT |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2908 DT_CENTER |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2909 DT_VCENTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2910 0,0,0,0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2911 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2912 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2913 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2914 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2915 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2916
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2917 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2918 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2919 sizeof(DefaultFont),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2920 DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2921
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2922
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2923 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2924 PP_BACKGROUNDCOLORINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2925 sizeof(ulColor),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2926 &ulColor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2927
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2928 WinSetWindowText(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2929 bubble->bubbletext);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2930
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2931 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2932
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2933 hpsTemp = WinGetPS(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2934 GpiQueryTextBox(hpsTemp,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2935 strlen(bubble->bubbletext),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2936 bubble->bubbletext,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2937 TXTBOX_COUNT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2938 txtPointl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2939 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2940
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2941 lWidth = txtPointl[TXTBOX_TOPRIGHT].x -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2942 txtPointl[TXTBOX_TOPLEFT ].x + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2943
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2944 lHight = txtPointl[TXTBOX_TOPLEFT].y -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2945 txtPointl[TXTBOX_BOTTOMLEFT].y + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2946
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2947 ptlWork.y -= lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2948
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2949 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2950
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2951 if(blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2952 WinSetWindowPtr(hwndBubble, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2953
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2954 WinSetWindowPos(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2955 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2956 ptlWork.x,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2957 ptlWork.y,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2958 lWidth,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2959 lHight,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2960 SWP_SIZE | SWP_MOVE | SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2961 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2962 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2963 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2964
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
2965 if(!oldproc)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2966 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
2967 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2968 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2969
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2970 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2971 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2972 int res = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2973 res = (int)_run_event(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2974 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2975 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2976 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2977 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2978 case WM_BUTTON3DOWN:
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2979 if(res == -1)
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2980 WinSetFocus(HWND_DESKTOP, hwnd);
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2981 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
2982 return (MPARAM)TRUE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2983 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2984 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2985 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2986
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2987 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
2988 {
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
2989 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
2990 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
2991
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2992 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
2993 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
2994
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2995 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
2996 {
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
2997 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
2998 {
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2999 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
3000 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
3001 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
3002
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3003 if(oldproc)
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 128
diff changeset
3004 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
3005
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3006 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
3007 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
3008 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
3009 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
3010 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
3011 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
3012
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3013 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
3014 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
3015 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
3016 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
3017 }
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3018 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
3019 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
3020 _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
3021 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
3022 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
3023 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
3024 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3025 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
3026 _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
3027 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
3028 _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
3029 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
3030 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3031 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
3032 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3033
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3034 _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
3035
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
3036 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
3037 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
3038
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3039 return WinDefWindowProc(hwnd, msg, mp1, mp2);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3040 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3041
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3042 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3043 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3044 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3045 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3046 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3047 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3048 int API dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3049 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3050 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3051
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3052 if(newthread)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3053 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3054 dwhab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3055 dwhmq = WinCreateMsgQueue(dwhab, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3056 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3057
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3058 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3059 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3060
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3061 /* Get the OS/2 version. */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3062 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
3063
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
3064 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE);
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
3065
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3066 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3067 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3068
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3069 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3070 * 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
3071 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3072 void API dw_main(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3073 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3074 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3075
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3076 _dwtid = dw_thread_id();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3077
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3078 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
3079 {
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3080 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
3081 _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
3082 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
3083 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3084
150
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
3085 WinDestroyMsgQueue(dwhmq);
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
3086 WinTerminate(dwhab);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3087 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3088
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3089 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
3090 * 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
3091 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
3092 * 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
3093 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3094 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
3095 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3096 QMSG qmsg;
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
3097 double start = (double)clock();
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
3098
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
3099 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds)
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3100 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3101 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3102 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3103 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3104 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
3105 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3106 WinDispatchMsg(dwhab, &qmsg);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3107 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3108 else
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3109 DosSleep(1);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3110 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3111 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3112
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3113 /*
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
3114 * 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
3115 */
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
3116 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
3117 {
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
3118 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
3119
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
3120 _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
3121
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
3122 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
3123 {
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
3124 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
3125 _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
3126 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
3127 }
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
3128 }
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
3129
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
3130 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3131 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3132 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3133 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3134 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3135 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3136 void API dw_free(void *ptr)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3137 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3138 free(ptr);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3139 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3140
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3141 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3142 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3143 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3144 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3145 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3146 DWDialog * API dw_dialog_new(void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3147 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3148 DWDialog *tmp = malloc(sizeof(DWDialog));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3149
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3150 tmp->eve = dw_event_new();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3151 dw_event_reset(tmp->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3152 tmp->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3153 tmp->done = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3154 tmp->result = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3155
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3156 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3157 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3158
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3159 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3160 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3161 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3162 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3163 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3164 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3165 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3166 int API dw_dialog_dismiss(DWDialog *dialog, void *result)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3167 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3168 dialog->result = result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3169 dw_event_post(dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3170 dialog->done = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3171 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3172 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3173
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3174 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3175 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3176 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3177 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3178 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3179 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3180 void * API dw_dialog_wait(DWDialog *dialog)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3181 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3182 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3183 void *tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3184
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3185 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3186 {
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3187 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
3188 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3189 WinDispatchMsg(dwhab, &qmsg);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3190 if(dialog->done)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3191 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3192 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3193 dw_event_close(&dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3194 tmp = dialog->result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3195 free(dialog);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3196 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3197 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3198
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3199
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3200 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3201 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3202 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3203 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3204 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3205 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3206 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3207 int API dw_messagebox(char *title, char *format, ...)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3208 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3209 va_list args;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3210 char outbuf[1024];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3211
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3212 va_start(args, format);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3213 vsprintf(outbuf, format, args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3214 va_end(args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3215
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3216 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3217
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3218 return strlen(outbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3219 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3220
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3221 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3222 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3223 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3224 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3225 * text: The text to display in the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3226 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3227 * True if YES False of NO.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3228 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3229 int API dw_yesno(char *title, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3230 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3231 if(WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, title, 0, MB_YESNO | MB_INFORMATION | MB_MOVEABLE | MB_SYSTEMMODAL)==MBID_YES)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3232 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3233 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3234 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3235
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3236 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3237 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3238 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3239 * 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
3240 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3241 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
3242 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3243 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
3244 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3245
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3246 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3247 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3248 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3249 * 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
3250 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3251 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
3252 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3253 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
3254 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3255
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3256 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3257 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3258 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3259 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3260 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3261 int API dw_window_show(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3262 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3263 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3264 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3265 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3266
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
3267 _fix_button_owner(_toplevel_window(handle), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3268 WinSetFocus(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3269 _initial_focus(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3270
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3271 /* If this window has a switch list entry make sure it is visible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3272 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3273 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3274 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3275 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3276 swcntrl.uchVisibility = SWL_VISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3277 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3278 }
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3279 if(WinWindowFromID(handle, FID_CLIENT))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3280 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3281 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3282
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3283 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
3284 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3285 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
3286 int newx, newy, changed = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3287 SWP swp;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3288
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3289 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3290
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3291 WinQueryWindowPos(handle, &swp);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3292
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3293 newx = swp.x;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3294 newy = swp.y;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3295
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3296 if((swp.x+swp.cx) > cx)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3297 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3298 newx = (cx - swp.cx)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3299 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3300 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3301 if((swp.y+swp.cy) > cy)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3302 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3303 newy = (cy - swp.cy)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3304 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3305 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3306 if(changed)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3307 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
3308 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3309 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3310 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3311 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3312
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3313 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3314 * 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
3315 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3316 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3317 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3318 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
3319 {
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3320 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
3321
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3322 if(hwndclient)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3323 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3324 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
3325
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3326 if(box)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3327 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3328 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
3329 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
3330 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3331 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3332
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3333 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
3334 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3335
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3336 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3337 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3338 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3339 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3340 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3341 int API dw_window_hide(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3342 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3343 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3344 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3345
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3346 /* If this window has a switch list entry make sure it is invisible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3347 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3348 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3349 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3350 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3351 swcntrl.uchVisibility = SWL_INVISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3352 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3353 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3354 return WinShowWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3355 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3356
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3357 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3358 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3359 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3360 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3361 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3362 int API dw_window_destroy(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3363 {
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
3364 HWND parent = WinQueryWindow(handle, QW_PARENT);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3365 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
3366
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3367 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
3368 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
3369
210
b9c7b762c104 When comparing the desktop value, use the queried value not the constant.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 207
diff changeset
3370 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
3371 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3372 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
3373 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
3374
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3375 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
3376 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3377 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
3378 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
3379 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3380
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3381 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
3382 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
3383
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3384 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
3385
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3386 /* 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
3387 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
3388 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3389 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
3390 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3391 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
3392 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3393 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
3394 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3395
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3396 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
3397 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
3398 thisbox->count--;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3399 _free_window_memory(handle);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3400 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3401 return WinDestroyWindow(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3402 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3403
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
3404 /* 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
3405 * 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
3406 * 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
3407 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3408 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
3409 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3410 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
3411 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
3412 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
3413
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3414 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
3415 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3416 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
3417
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3418 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
3419
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3420 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
3421 _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
3422 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
3423 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3424 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3425
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3426 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3427 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3428 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3429 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3430 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3431 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3432 void API dw_window_reparent(HWND handle, HWND newparent)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3433 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3434 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3435 WinSetParent(handle, blah ? blah : newparent, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3436 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3437
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3438 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3439 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3440 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3441 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3442 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3443 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3444 int API dw_window_set_font(HWND handle, char *fontname)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3445 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3446 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3447 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3448
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3449 /* Internal version */
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3450 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3451 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3452 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3453 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3454 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3455
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3456 rgb2.bBlue = DW_BLUE_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3457 rgb2.bGreen = DW_GREEN_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3458 rgb2.bRed = DW_RED_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3459 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3460
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3461 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3462
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3463 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3464 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
3465 {
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
3466 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
3467
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3468 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
3469 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3470 if((back & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3471 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3472 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3473
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3474 rgb2.bBlue = DW_BLUE_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3475 rgb2.bGreen = DW_GREEN_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3476 rgb2.bRed = DW_RED_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3477 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3478
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3479 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3480 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3481 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3482 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
3483 {
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
3484 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
3485
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3486 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
3487 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3488 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3489 }
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3490 /*
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3491 * 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
3492 * Parameters:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3493 * handle: The window (widget) handle.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3494 * 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
3495 * 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
3496 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3497 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
3498 {
228
326e114923cf Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 225
diff changeset
3499 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
3500 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
3501
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3502 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
3503 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3504
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3505 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3506 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3507 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3508 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3509 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3510 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3511 int API dw_window_set_border(HWND handle, int border)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3512 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3513 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3514 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3515 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3516
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3517 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3518 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3519 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3520 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3521 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3522 void API dw_window_capture(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3523 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3524 WinSetCapture(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3525 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3526
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3527 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3528 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3529 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3530 void API dw_window_release(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3531 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3532 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3533 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3534
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3535 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3536 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3537 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3538 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3539 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3540 void API dw_window_track(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3541 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3542 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3543 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3544
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3545 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3546 * 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
3547 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3548 * 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
3549 * 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
3550 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3551 void API dw_window_pointer(HWND handle, int pointertype)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3552 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3553 WinSetPointer(handle,
337
e9a424e641ff Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 336
diff changeset
3554 pointertype < 65535 ?
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3555 WinQuerySysPointer(HWND_DESKTOP,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3556 pointertype,
337
e9a424e641ff Some pointer changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 336
diff changeset
3557 FALSE) : (HPOINTER)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
3558 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3559
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3560 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3561 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3562 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3563 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3564 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3565 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3566 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3567 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3568 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3569 HWND hwndclient = 0, hwndframe;
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3570 Box *newbox = calloc(1, sizeof(Box));
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3571 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3572
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3573 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
3574 newbox->type = DW_VERT;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3575 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3576
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3577 flStyle |= FCF_NOBYTEALIGN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3578
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3579 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
3580 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
3581 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3582 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
3583
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3584 if(!(flStyle & FCF_SHELLPOSITION))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3585 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3586
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3587 hwndframe = WinCreateStdWindow(hwndOwner, 0L, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &hwndclient);
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3588 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
3589 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
3590 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3591 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3592 WinSetWindowPtr(hwndframe, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3593 WinSetWindowPtr(hwndclient, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3594
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3595 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3596 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3597
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3598 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3599 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3600 * 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
3601 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3602 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3603 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3604 HWND API dw_box_new(int type, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3605 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3606 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3607 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3608
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3609 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3610 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3611 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3612 newbox->grouphwnd = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3613
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3614 hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3615 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3616 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
3617 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
3618 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3619 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3620 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3621 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3622 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3623 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3624 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3625
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3626 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3627 WinSetWindowPtr(hwndframe, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3628 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3629 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3630 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3631
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3632 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3633 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3634 * 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
3635 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3636 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3637 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3638 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3639 HWND API dw_groupbox_new(int type, int pad, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3640 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3641 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3642 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3643
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3644 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3645 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3646 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3647
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3648 hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3649 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3650 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
3651 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
3652 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3653 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3654 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3655 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3656 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3657 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3658 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3659
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3660 newbox->grouphwnd = WinCreateWindow(hwndframe,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3661 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3662 title,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3663 WS_VISIBLE | SS_GROUPBOX |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3664 WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3665 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3666 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3667 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3668 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3669 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3670 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3671
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3672 WinSetWindowPtr(hwndframe, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3673 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3674 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3675 dw_window_set_font(newbox->grouphwnd, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3676 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3677 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3678
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3679 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3680 * 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
3681 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3682 * 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
3683 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3684 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
3685 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3686 HWND hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3687
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3688 hwndframe = WinCreateWindow(HWND_OBJECT,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3689 WC_FRAME,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3690 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
3691 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
3692 FS_NOBYTEALIGN,
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3693 0,0,2000,1000,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3694 NULLHANDLE,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3695 HWND_TOP,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3696 0L,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3697 NULL,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3698 NULL);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3699 return hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3700 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3701
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3702 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3703 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3704 * 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
3705 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3706 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3707 HWND API dw_bitmap_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3708 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3709 return WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3710 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3711 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3712 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3713 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3714 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3715 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3716 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3717 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3718 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3719 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3720
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3721 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3722 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3723 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3724 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3725 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3726 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3727 HWND API dw_notebook_new(ULONG id, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3728 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3729 ULONG flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3730 HWND tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3732 if(top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3733 flags = BKS_MAJORTABTOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3734 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3735 flags = BKS_MAJORTABBOTTOM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3736
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3737 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3738 WC_NOTEBOOK,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3739 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3740 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3741 BKS_TABBEDDIALOG |
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3742 flags,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3743 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3744 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3745 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3746 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3747 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3748 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3749
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3750 /* Fix tab sizes on Warp 3 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3751 if(!IS_WARP4())
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3752 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3753 /* 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
3754 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
3755 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3756
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3757 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3758 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3759 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3760
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3761 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3762 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3763 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3764 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3765 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3766 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3767 HMENUI API dw_menu_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3768 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3769 HMENUI tmp = WinCreateWindow(HWND_OBJECT,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3770 WC_MENU,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3771 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3772 WS_VISIBLE,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3773 0,0,2000,1000,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3774 NULLHANDLE,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3775 HWND_TOP,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3776 id,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3777 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3778 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3779 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3780 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3781
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3782 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3783 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3784 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3785 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3786 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3787 HMENUI API dw_menubar_new(HWND location)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3788 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3789 HMENUI tmp = WinCreateWindow(location,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3790 WC_MENU,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3791 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3792 WS_VISIBLE | MS_ACTIONBAR,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3793 0,0,2000,1000,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3794 location,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3795 HWND_TOP,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3796 FID_MENU,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3797 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3798 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3799 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3800 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3801
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3802 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3803 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3804 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3805 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3806 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3807 void API dw_menu_destroy(HMENUI *menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3808 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3809 if(menu)
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3810 WinDestroyWindow(*menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3811 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3813 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3814 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3815 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3816 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3817 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3818 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3819 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3820 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3821 * check: If TRUE menu is "check"able.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3822 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3823 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3824 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3825 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3826 MENUITEM miSubMenu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3827
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3828 if(!menux)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3829 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3830
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3831 if(end)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3832 miSubMenu.iPosition=MIT_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3833 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3834 miSubMenu.iPosition=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3835
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3836 if(strlen(title) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3837 miSubMenu.afStyle=MIS_SEPARATOR | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3838 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3839 miSubMenu.afStyle=MIS_TEXT | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3840 miSubMenu.afAttribute=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3841 miSubMenu.id=id;
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3842 miSubMenu.hwndSubMenu = submenu;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3843 miSubMenu.hItem=NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3844
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3845 WinSendMsg(menux,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3846 MM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3847 MPFROMP(&miSubMenu),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3848 MPFROMP(title));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3849 return (HWND)id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3850 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3851
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3852 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3853 * Sets the state of a menu item check.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3854 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3855 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3856 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3857 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3858 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3859 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3860 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3861 if(check)
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3862 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3863 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3864 else
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3865 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3866 MPFROM2SHORT(MIA_CHECKED, 0));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3867 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3868
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3869 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3870 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3871 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3872 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3873 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3874 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3875 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3876 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3877 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3878 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3879 if(menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3880 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
3881 popup = parent;
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
3882 WinPopupMenu(HWND_DESKTOP, parent, *menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3883 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3884 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3885
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3886 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3887 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3888 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3889 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3890 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3891 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3892 void API dw_pointer_query_pos(long *x, long *y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3893 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3894 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3895
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3896 WinQueryPointerPos(HWND_DESKTOP, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3897 if(x && y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3898 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3899 *x = ptl.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3900 *y = dw_screen_height() - ptl.y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3901 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3902 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3903
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3904 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3905 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3906 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3907 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3908 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3909 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3910 void API dw_pointer_set_pos(long x, long y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3911 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3912 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3913 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3914
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
3915
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3916 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3917 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3918 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3919 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3920 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3921 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3922 HWND API dw_container_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3923 {
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
3924 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3925 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3926 WC_CONTAINER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3927 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3928 WS_VISIBLE | CCS_READONLY |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3929 CCS_SINGLESEL | CCS_AUTOPOSITION,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3930 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3931 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3932 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3933 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3934 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3935 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
3936 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
3937 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3938 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
3939 dw_window_set_data(tmp, "_dw_container", (void *)1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3940 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3941 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3942
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3943 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3944 * 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
3945 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3946 * 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
3947 * 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
3948 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3949 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
3950 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3951 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
3952 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
3953 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
3954 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
3955 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3956 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
3957 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
3958 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
3959 NULLHANDLE,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3960 HWND_TOP,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3961 id,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3962 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3963 NULL);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3964
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3965 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
3966 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
3967 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
3968 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
3969 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
3970 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
3971
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
3972 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
3973 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
3974 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
3975 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
3976 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
3977 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
3978 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3979
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3980 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3981 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3982 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3983 * 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
3984 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3985 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3986 HWND API dw_text_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3987 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3988 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3989 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3990 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3991 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3992 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3993 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3994 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3995 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3996 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3997 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3998 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3999 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4000 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4001 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4002
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4003 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4004 * 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
4005 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4006 * 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
4007 * 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
4008 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4009 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
4010 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4011 WindowData *blah = calloc(sizeof(WindowData), 1);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4012 HWND tmp = WinCreateWindow(HWND_OBJECT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4013 WC_STATIC,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4014 text,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4015 WS_VISIBLE | SS_TEXT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4016 0,0,2000,1000,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4017 NULLHANDLE,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4018 HWND_TOP,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4019 id,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4020 NULL,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4021 NULL);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4022 blah->oldproc = WinSubclassWindow(tmp, _statusproc);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4023 WinSetWindowPtr(tmp, QWP_USER, blah);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4024 dw_window_set_font(tmp, DefaultFont);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4025 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
4026 return tmp;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4027 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4028
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4029 #ifndef MLS_LIMITVSCROLL
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4030 #define MLS_LIMITVSCROLL 0x00000080L
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4031 #endif
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4032
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4033 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4034 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4035 * 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
4036 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4037 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4038 HWND API dw_mle_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4039 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4040 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4041 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4042 WC_MLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4043 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4044 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4045 MLS_BORDER | MLS_IGNORETAB |
152
e78027768548 Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
4046 MLS_READONLY | MLS_VSCROLL |
e78027768548 Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
4047 MLS_LIMITVSCROLL,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4048 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4049 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4050 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4051 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4052 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4053 NULL);
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
4054 blah->oldproc = WinSubclassWindow(tmp, _mleproc);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4055 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4056 dw_window_set_font(tmp, DefaultFont);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4057 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4058 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4059
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4060 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4061 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4062 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4063 * 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
4064 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4065 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4066 HWND API dw_entryfield_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4067 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4068
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4069 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4070 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4071 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4072 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4073 WS_VISIBLE | ES_MARGIN |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4074 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4075 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4076 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4077 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4078 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4079 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4080 NULL);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4081 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4082 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4083 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
4084 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4085 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4086 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4087
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4088 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4089 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4090 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4091 * 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
4092 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4093 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4094 HWND API dw_entryfield_password_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4095 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4096 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4097 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4098 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4099 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4100 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4101 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4102 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4103 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4104 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4105 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4106 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4107 NULL);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4108 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4109 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4110 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
4111 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4112 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4113 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4114
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4115 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4116 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4117 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4118 * 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
4119 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4120 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4121 HWND API dw_combobox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4122 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4123 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4124 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4125 WC_COMBOBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4126 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4127 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4128 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4129 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4130 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4131 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4132 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4133 NULL);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4134 HENUM henum = WinBeginEnumWindows(tmp);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4135 HWND child;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4136
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4137 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
4138 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4139 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
4140 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4141 WinSetWindowPtr(child, QWP_USER, moreblah);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4142 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4143 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4144 WinEndEnumWindows(henum);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4145 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4146 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4147 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
4148 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4149 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4150 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4151
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4152 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4153 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4154 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4155 * 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
4156 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4157 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4158 HWND API dw_button_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4159 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4160 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4161
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4162 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4163 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4164 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4165 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4166 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4167 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4168 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4169 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4170 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4171 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4172
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4173 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4174 bubble->bubbletext[0] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4175 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4176
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4177 WinSetWindowPtr(tmp, QWP_USER, bubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4178 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
4179 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4180 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4181 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4182
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4183 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4184 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4185 ** controls
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4186 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4187
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4188 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4189 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4190 char *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4191 int slen = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4192
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4193 *buff++ = '#';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4194
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4195 str = buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4196
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4197 do
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4198 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4199 *str++ = (ulID % 10) + '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4200 ulID /= 10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4201 slen++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4202 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4203 while(ulID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4204
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4205 *str-- = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4206
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4207 for(; str > buff; str--, buff++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4208 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4209 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4210 *str ^= *buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4211 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4212 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4213 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4214
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4215
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4216 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4217 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4218 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4219 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4220 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4221 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4222 HWND API dw_bitmapbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4223 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4224 char idbuf[256];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4225 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
4226 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4227
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4228 _GenResIDStr(idbuf, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4229
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4230 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4231 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4232 idbuf,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4233 WS_VISIBLE | BS_PUSHBUTTON |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4234 BS_BITMAP | BS_AUTOSIZE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4235 BS_NOPOINTERFOCUS,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4236 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4237 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4238 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4239 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4240 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4241 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4242
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4243 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4244 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4245 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4246 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4247
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4248 WinSetWindowPtr(tmp, QWP_USER, bubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4249 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4250 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4251
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4252 /*
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4253 * 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
4254 * Parameters:
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4255 * 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
4256 * 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
4257 * 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
4258 * 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
4259 * (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
4260 */
280
030188d45a69 Fixed typo in the filename parameter.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 278
diff changeset
4261 HWND dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename)
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4262 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4263 /* TODO: Actually get it to draw 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
4264 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
4265 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
4266 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
4267 "",
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4268 WS_VISIBLE | BS_PUSHBUTTON |
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4269 BS_BITMAP | BS_AUTOSIZE |
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4270 BS_NOPOINTERFOCUS,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4271 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
4272 NULLHANDLE,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4273 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
4274 id,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4275 NULL,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4276 NULL);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4277
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4278 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
4279 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
4280 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
4281 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
4282
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4283 WinSetWindowPtr(tmp, QWP_USER, bubble);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4284 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
4285 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4286
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4287 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4288 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4289 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4290 * 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
4291 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4292 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4293 HWND API dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4294 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4295 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4296 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4297 WC_SPINBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4298 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4299 WS_VISIBLE | SPBS_MASTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4300 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4301 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4302 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4303 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4304 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4305 NULL);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4306 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
4307 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4308 WinSetWindowPtr(tmp, QWP_USER, blah);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4309 blah = calloc(sizeof(WindowData), 1);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4310 blah->oldproc = WinSubclassWindow(entry, _spinentryproc);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4311 WinSetWindowPtr(entry, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4312 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
4313 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4314 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4315 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4316
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4317 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4318 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4319 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4320 * 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
4321 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4322 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4323 HWND API dw_radiobutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4324 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4325 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4326 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4327 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4328 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4329 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4330 BS_AUTORADIOBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4331 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4332 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4333 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4334 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4335 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4336 NULL);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4337 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4338 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4339 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4340 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4341 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4342 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4343
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4344
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4345 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4346 * 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
4347 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4348 * 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
4349 * 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
4350 * 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
4351 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4352 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
4353 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4354 WindowData *blah = calloc(1, sizeof(WindowData));
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4355 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
4356 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
4357
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4358 sldcData.cbSize = sizeof(SLDCDATA);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4359 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
4360
178
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4361 tmp = WinCreateWindow(HWND_OBJECT,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4362 WC_SLIDER,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4363 "",
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4364 WS_VISIBLE | SLS_SNAPTOINCREMENT |
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4365 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL),
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4366 0,0,2000,1000,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4367 NULLHANDLE,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4368 HWND_TOP,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4369 id,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4370 &sldcData,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4371 NULL);
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4372
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4373 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
4374 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
4375 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
4376 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4377
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4378 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4379 * 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
4380 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4381 * 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
4382 * 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
4383 * 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
4384 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4385 HWND API dw_scrollbar_new(int vertical, int increments, ULONG id)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4386 {
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
4387 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
4388 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
4389 "",
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
4390 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
4391 (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
4392 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
4393 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
4394 HWND_TOP,
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4395 id,
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4396 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
4397 NULL);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4398 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4399
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4400 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4401 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4402 * 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
4403 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4404 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4405 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
4406 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4407 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
4408 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
4409 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
4410 "",
62
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4411 WS_VISIBLE | SLS_READONLY
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4412 | 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
4413 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
4414 NULLHANDLE,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4415 HWND_TOP,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4416 id,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4417 NULL,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4418 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
4419 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
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_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
4422 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4423 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4424
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4425 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4426 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4427 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4428 * 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
4429 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4430 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4431 HWND API dw_checkbox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4432 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4433 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4434 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4435 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4436 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4437 WS_VISIBLE | BS_AUTOCHECKBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4438 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4439 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4440 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4441 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4442 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4443 NULL);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4444 bubble->id = id;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4445 bubble->bubbletext[0] = '\0';
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4446 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4447 WinSetWindowPtr(tmp, QWP_USER, bubble);
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);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4449 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4450 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4451 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4452
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4453 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4454 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4455 * 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
4456 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4457 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4458 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4459 HWND API dw_listbox_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4460 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4461 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4462 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4463 WC_LISTBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4464 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4465 WS_VISIBLE | LS_NOADJUSTPOS |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4466 (multi ? LS_MULTIPLESEL : 0),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4467 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4468 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4469 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4470 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4471 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4472 NULL);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4473 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4474 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
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
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4477 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4478 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4479
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4480 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4481 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4482 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4483 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4484 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4485 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4486 void API dw_window_set_icon(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4487 {
336
a2f72b5d5d0a Minor change to dw_window_set_icon() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 328
diff changeset
4488 HPOINTER icon = id < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id) : (HPOINTER)id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4489 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4490 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4491
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4492 /* 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
4493 * 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
4494 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4495 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
4496 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4497 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
4498 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
4499 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
4500 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
4501 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
4502 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
4503 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
4504 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
4505 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
4506 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
4507 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
4508
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4509 /* 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
4510 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
4511 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
4512 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
4513 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
4514 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
4515
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4516 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
4517 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
4518
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4519 /* 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
4520 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
4521 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
4522
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4523 /* 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
4524 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
4525 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
4526
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4527 /* 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
4528 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
4529 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
4530
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4531 /* 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
4532 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
4533
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4534 /* 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
4535 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
4536 (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
4537 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4538 /* 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
4539 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
4540 /* 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
4541 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
4542 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
4543 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4544
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4545 /* 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
4546 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
4547 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4548 /* 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
4549 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
4550 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4551
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4552 /* 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
4553 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
4554
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4555 /* 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
4556 /* 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
4557 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER))
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4558 ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4559 else
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4560 ScanLines = pBitmapInfoHeader->cy;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4561
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4562 /* 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
4563 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
4564
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4565 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
4566 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
4567
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4568 *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
4569 *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
4570
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4571 *width = pBitmapInfoHeader->cx; *height = pBitmapInfoHeader->cy;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4572
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4573 /* 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
4574 *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
4575
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4576 /* 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
4577 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
4578
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4579 /* 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
4580 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
4581 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
4582 (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
4583
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4584 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
4585
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4586 /* 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
4587 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
4588 /* 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
4589 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
4590 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
4591 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4592
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4593 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4594 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4595 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4596 * 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
4597 * 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
4598 * (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
4599 * 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
4600 * 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
4601 * 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
4602 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4603 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4604 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4605 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
4606 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
4607
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4608 /* 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
4609 _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
4610
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4611 /* 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
4612 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
4613 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4614 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
4615
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4616 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
4617 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4618 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
4619 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4620 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
4621 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
4622 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
4623
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4624 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
4625 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4626
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4627 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
4628
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4629 /* 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
4630 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
4631 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4632 /* 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
4633 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
4634 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
4635 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4636 }
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 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
4639 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4640
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4641 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
4642 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
4643 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
4644 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
4645 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4646 else
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4647 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4648
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4649 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4650 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
4651 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
4652 WinReleasePS(hps);
235
69f2a59ec7d0 Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 230
diff changeset
4653 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4654 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4655
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4656 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4657 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4658 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4659 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4660 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4661 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4662 void API dw_window_set_text(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4663 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4664 WinSetWindowText(handle, text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4665 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4666
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4667 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4668 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4669 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4670 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4671 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4672 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4673 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4674 char * API dw_window_get_text(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4675 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4676 int len = WinQueryWindowTextLength(handle);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4677 char *tempbuf = calloc(1, len + 2);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4678
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4679 WinQueryWindowText(handle, len + 1, tempbuf);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4680
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4681 return tempbuf;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4682 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4683
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4684 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4685 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4686 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4687 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4688 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4689 void API dw_window_disable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4690 {
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4691 char tmpbuf[100];
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4692
166
fb2987817924 Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
4693 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
4694 return;
fb2987817924 Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
4695
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4696 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
4697 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
4698
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4699 if(tmpbuf[0] == '#')
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4700 {
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4701 int val = atoi(&tmpbuf[1]);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4702 HWND hwnd;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4703
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4704 switch(val)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4705 {
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4706 case 2:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4707 case 6:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4708 case 10:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4709 case 32:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4710 case 7:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4711 hwnd = _find_entryfield(handle);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4712 _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
4713 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
4714 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
4715 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
4716 if(hwnd)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4717 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
4718 return;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4719 case 3:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4720 _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
4721 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
4722 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
4723 return;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4724 }
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4725 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4726 WinEnableWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4727 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4728
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4729 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4730 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4731 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4732 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4733 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4734 void API dw_window_enable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4735 {
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4736 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
4737 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
4738 HWND hwnd = _find_entryfield(handle);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4739
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4740 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
4741 if(hwnd)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4742 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
4743 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
4744 _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
4745 dw_signal_disconnect_by_data(handle, (void *)100);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4746 WinEnableWindow(handle, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4747 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4748
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4749 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4750 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4751 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4752 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4753 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4754 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4755 HWND API dw_window_from_id(HWND handle, int id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4756 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4757 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4758 HWND child;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4759 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4760
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4761 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4762 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4763 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4764 int windowid = WinQueryWindowUShort(child, QWS_ID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4765 HWND found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4766
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4767 WinQueryClassName(child, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4768
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4769 /* 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
4770 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4771 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4772 return found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4773
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4774 if(windowid && windowid == id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4775 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4776 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4777 return child;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4778 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4779 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4780 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4781 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4782 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4783
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4784 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4785 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4786 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4787 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4788 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4789 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4790 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4791 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4792 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4793 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4794 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4795 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4796 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4797 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4798
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4799 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4800 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4801 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4802 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4803 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4804 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4805 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4806 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4807 {
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
4808 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4809 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4810 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4811 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4812 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4813 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4814
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4815 void dw_box_pack_end_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4816 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4817 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4818
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4819 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4820 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4821 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4822 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4823 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4824 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4825 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4826 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4827 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4828 if(!thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4829 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4830 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4831 if(box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4832 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4833 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4834 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4835 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4836 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4837 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4838 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4839 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4840 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4841 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4842 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4843
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4844 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4845
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4846 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4847 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4848 tmpitem[z] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4849 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4850
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4851 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4852
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
4853 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
4854 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
4855 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
4856 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
4857
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
4858 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4859 tmpitem[thisbox->count].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4860 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4861 tmpitem[thisbox->count].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4862
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4863 tmpitem[thisbox->count].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4864 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4865 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4866 tmpitem[thisbox->count].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4867 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4868 tmpitem[thisbox->count].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4869 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4870 tmpitem[thisbox->count].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4871
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4872 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4873 tmpitem[thisbox->count].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4874 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4875 tmpitem[thisbox->count].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4876
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4877 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4878
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4879 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4880 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4881
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4882 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4883
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4884 /* Don't set the ownership if it's an entryfield or spinbutton */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4885 WinQueryClassName(item, 99, tmpbuf);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4886 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0)
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4887 WinSetOwner(item, box);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4888 WinSetParent(item, box, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4889 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4890 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4891
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4892 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4893 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4894 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4895 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4896 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4897 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4898 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4899 void API dw_window_set_usize(HWND handle, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4900 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4901 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4902 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4903
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4904 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4905 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4906 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4907 int API dw_screen_width(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4908 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4909 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4910 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4911
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4912 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4913 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4914 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4915 int API dw_screen_height(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4916 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4917 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4918 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4919
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4920 /* This should return the current color depth */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4921 unsigned long API dw_color_depth(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4922 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4923 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4924 long colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4925
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4926 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4927 DevCloseDC(hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4928 return colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4929 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4930
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4931
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4932 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4933 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4934 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4935 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4936 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4937 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4938 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4939 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4940 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4941 int myy = _get_frame_height(handle) - (y + _get_height(handle));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4942
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4943 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4944 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4945
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4946 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4947 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4948 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4949 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4950 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4951 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4952 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4953 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4954 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4955 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4956 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4957 int myy = _get_frame_height(handle) - (y + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4958
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4959 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4960 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4961
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4962 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4963 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4964 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4965 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4966 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4967 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4968 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4969 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4970 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4971 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4972 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4973 SWP swp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4974 WinQueryWindowPos(handle, &swp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4975 if(x)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4976 *x = swp.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4977 if(y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4978 *y = _get_frame_height(handle) - (swp.y + swp.cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4979 if(width)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4980 *width = swp.cx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4981 if(height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4982 *height = swp.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4983 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4984
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4985 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4986 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4987 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4988 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4989 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4990 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4991 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4992 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4993 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4994 WinSetWindowBits(handle, QWL_STYLE, style, mask);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4995 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4996
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4997 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4998 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4999 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5000 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5001 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5002 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5003 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5004 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5005 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5006 if(front)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5007 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5008 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_FIRST));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5009 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5010 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_LAST));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5011 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5012
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5013 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5014 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5015 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5016 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5017 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5018 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5019 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5020 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5021 WinSendMsg(handle, BKM_DELETEPAGE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5022 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5023 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5024
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5025 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5026 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5027 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5028 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5029 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5030 unsigned int API dw_notebook_page_query(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5031 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5032 return (int)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5033 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5034
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5035 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5036 * Sets the currently visibale page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5037 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5038 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5039 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5040 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5041 void API dw_notebook_page_set(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5042 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5043 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5044 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5045
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5046 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5047 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5048 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5049 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5050 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5051 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5052 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5053 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5054 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5055 WinSendMsg(handle, BKM_SETTABTEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5056 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5057 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5058
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5059 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5060 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5061 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5062 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5063 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5064 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5065 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5066 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5067 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5068 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5069 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5070 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5071
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5072 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5073 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5074 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5075 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5076 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5077 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5078 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5079 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5080 {
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
5081 HWND tmpbox = dw_box_new(DW_VERT, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5082
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5083 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5084 WinSubclassWindow(tmpbox, _wndproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5085 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5086 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5087 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5088
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5089 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5090 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5091 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5092 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5093 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5094 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5095 void API dw_listbox_append(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5096 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5097 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5098 LM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5099 MPFROMSHORT(LIT_END),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5100 MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5101 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5102
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5103 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5104 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5105 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5106 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5107 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5108 void API dw_listbox_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5109 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5110 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5111 LM_DELETEALL, 0L, 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5112 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5113
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5114 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5115 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5116 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5117 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5118 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5119 int API dw_listbox_count(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5120 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5121 return (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5122 LM_QUERYITEMCOUNT,0L, 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5123 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5124
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5125 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5126 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5127 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5128 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5129 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5130 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5131 void API dw_listbox_set_top(HWND handle, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5132 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5133 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5134 LM_SETTOPINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5135 MPFROMSHORT(top),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5136 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5137 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5138
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5139 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5140 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5141 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5142 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5143 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5144 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5145 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5146 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5147 void API dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5148 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5149 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5150 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5151
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5152 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5153 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5154 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5155 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5156 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5157 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5158 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5159 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5160 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5161 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5162 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5163
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5164 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5165 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5166 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5167 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5168 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5169 unsigned int API dw_listbox_selected(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5170 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5171 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
5172 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
5173 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
5174 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5175 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5176
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5177 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5178 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5179 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5180 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5181 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5182 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5183 int API dw_listbox_selected_multi(HWND handle, int where)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5184 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5185 int place = where;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5186
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5187 if(where == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5188 place = LIT_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5189
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5190 place = (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5191 LM_QUERYSELECTION,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5192 MPFROMSHORT(place),0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5193 if(place == LIT_NONE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5194 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5195 return place;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5196 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5197
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5198 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5199 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5200 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5201 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5202 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5203 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5204 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5205 void API dw_listbox_select(HWND handle, int index, int state)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5206 {
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
5207 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
5208
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5209 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
5210
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5211 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
5212
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5213 /* 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
5214 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
5215 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5216 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5217
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5218 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5219 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5220 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5221 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5222 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5223 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5224 void API dw_listbox_delete(HWND handle, int index)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5225 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5226 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5227 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5228
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5229 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5230 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5231 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5232 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5233 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5234 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5235 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5236 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5237 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5238 unsigned long point = startpoint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5239 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5240
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5241 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5242 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5243 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5244 int amount, len = strlen(buffer), written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5245
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5246 while(written < len)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5247 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5248 if((len - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5249 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5250 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5251 amount = len - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5252
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5253 memcpy(mlebuf, &buffer[written], amount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5254 mlebuf[amount] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5255
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5256 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5257 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5258 dw_mle_delete(handle, point, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5259
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5260 written += amount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5261 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5262 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5263 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5264 return point - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5265 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5266
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5267 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5268 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5269 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5270 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5271 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5272 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5273 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5274 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5275 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5276 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5277 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5278
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5279 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5280 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5281 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5282 int amount, copied, written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5283
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5284 while(written < length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5285 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5286 if((length - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5287 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5288 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5289 amount = length - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5290
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5291 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5292 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5294 if(copied)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5295 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5296 memcpy(&buffer[written], mlebuf, copied);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5297
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5298 written += copied;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5299 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5300 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5301 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5302 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5303 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5304 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5305 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5306
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5307 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5308 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5309 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5310 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5311 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5312 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5313 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5314 void API dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5315 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5316 if(bytes)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5317 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5318 if(lines)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5319 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5320 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5321
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5322 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5323 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5324 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5325 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5326 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5327 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5328 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5329 void API dw_mle_delete(HWND handle, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5330 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5331 char *buf = malloc(length+1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5332 int z, dellen = length;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5333
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5334 dw_mle_export(handle, buf, startpoint, length);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5335
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5336 for(z=0;z<length-1;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5337 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5338 if(strncmp(&buf[z], "\r\n", 2) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5339 dellen--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5340 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5341 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5342 free(buf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5343 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5344
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5345 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5346 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5347 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5348 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5349 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5350 void API dw_mle_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5351 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5352 unsigned long bytes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5353
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5354 dw_mle_query(handle, &bytes, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5355
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5356 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5357 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5358
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5359 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5360 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5361 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5362 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5363 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5364 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5365 void API dw_mle_set_visible(HWND handle, int line)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5366 {
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
5367 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
5368 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5369 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5370
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5371 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5372 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5373 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5374 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5375 * 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
5376 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5377 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
5378 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5379 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5380 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5381
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5382 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5383 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5384 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5385 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5386 * 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
5387 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5388 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
5389 {
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
5390 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5391 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5392
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5393 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5394 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5395 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5396 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5397 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5398 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5399 void API dw_mle_set(HWND handle, int point)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5400 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5401 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5402 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5403
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5404 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5405 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5406 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5407 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5408 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5409 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5410 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5411 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5412 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5413 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5414 MLE_SEARCHDATA msd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5415
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
5416 /* 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
5417 * 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
5418 */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5419 msd.cb = sizeof(msd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5420 msd.pchFind = text;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5421 msd.pchReplace = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5422 msd.cchFind = strlen(text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5423 msd.cchReplace = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5424 msd.iptStart = point;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5425 msd.iptStop = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5426
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5427 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5428 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5429 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5430 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5431
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5432 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5433 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5434 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5435 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5436 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5437 void API dw_mle_freeze(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5438 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5439 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5440 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5441
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5442 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5443 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5444 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5445 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5446 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5447 void API dw_mle_thaw(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5448 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5449 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5450 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5451
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5452 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5453 * Returns the range of the percent bar.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5454 * 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
5455 * handle: Handle to the percent bar to be queried.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5456 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5457 unsigned int API dw_percent_query_range(HWND handle)
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5458 {
62
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5459 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5460 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5461
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5462 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5463 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5464 * 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
5465 * 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
5466 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5467 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5468 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
5469 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5470 _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
5471 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5472 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5473
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5474 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5475 * 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
5476 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5477 * 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
5478 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5479 unsigned int API dw_slider_query_pos(HWND handle)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5480 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5481 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
5482 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5483
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5484 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5485 * 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
5486 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5487 * 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
5488 * 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
5489 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5490 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
5491 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5492 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
5493 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
5494 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5495
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5496 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5497 * 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
5498 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5499 * 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
5500 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5501 unsigned int API dw_scrollbar_query_pos(HWND handle)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5502 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5503 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
5504 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5505
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5506 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5507 * 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
5508 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5509 * 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
5510 * 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
5511 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5512 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
5513 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5514 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
5515 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
5516 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5517
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5518 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5519 * 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
5520 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5521 * 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
5522 * 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
5523 * 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
5524 */
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
5525 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
5526 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5527 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
5528 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
5529 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
5530 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
5531 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5532
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5533 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5534 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5535 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5536 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5537 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5538 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5539 void API dw_spinbutton_set_pos(HWND handle, long position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5540 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5541 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5542 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5543
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5544 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5545 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5546 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5547 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5548 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5549 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5550 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5551 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5552 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5553 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5554 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5555
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5556 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5557 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5558 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5559 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5560 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5561 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5562 void API dw_entryfield_set_limit(HWND handle, ULONG limit)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5563 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5564 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5565 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5566
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5567
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5568 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5569 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5570 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5571 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5572 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5573 long API dw_spinbutton_query(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5574 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5575 long tmpval = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5576
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5577 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5578 return tmpval;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5579 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5580
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5581 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5582 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5583 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5584 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5585 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5586 int API dw_checkbox_query(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5587 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5588 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5589 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5590
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5591 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5592 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5593 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5594 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5595 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5596 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5597 void API dw_checkbox_set(HWND handle, int value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5598 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5599 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5600 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5601
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5602 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5603 * 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
5604 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5605 * 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
5606 * 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
5607 * 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
5608 * 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
5609 * 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
5610 * 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
5611 */
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
5612 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
5613 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5614 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
5615 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
5616 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
5617
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5618 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
5619 item = (HTREEITEM)CMA_FIRST;
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5620
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5621 /* 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
5622 * 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
5623 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5624
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5625 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
5626
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5627 /* 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
5628
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5629 pci = WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5630
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5631 /* 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
5632
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5633 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
5634 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
5635 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
5636
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5637 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
5638 pci->user = itemdata;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5639
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5640 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
5641
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5642 ri.cb = sizeof(RECORDINSERT);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5643 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
5644 ri.pRecordParent = (PRECORDCORE)NULL;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5645 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
5646 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
5647 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
5648
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5649 /* 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
5650 * 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
5651 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5652 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
5653
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5654 /* 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
5655 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
5656
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
5657 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
5658 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5659
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5660 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5661 * 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
5662 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5663 * 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
5664 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5665 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5666 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5667 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5668 */
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
5669 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
5670 {
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
5671 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
5672 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5673
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5674 /*
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
5675 * 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
5676 * 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
5677 * 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
5678 * 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
5679 * 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
5680 * 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
5681 */
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
5682 void API dw_tree_set(HWND handle, HTREEITEM item, char *title, unsigned long icon)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5683 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5684 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
5685
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5686 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
5687 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
5688
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5689 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
5690 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
5691
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5692 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
5693 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
5694
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5695 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
5696
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5697 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
5698 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5699
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5700 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5701 * 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
5702 * 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
5703 * 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
5704 * 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
5705 * 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
5706 */
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
5707 void API dw_tree_set_data(HWND handle, HTREEITEM item, void *itemdata)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5708 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5709 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
5710
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5711 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
5712 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
5713
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5714 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
5715 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5716
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5717 /*
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
5718 * 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
5719 * Parameters:
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
5720 * 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
5721 * 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
5722 */
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
5723 void * API dw_tree_get_data(HWND handle, HTREEITEM item)
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
5724 {
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
5725 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
5726
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
5727 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
5728 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
5729 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
5730 }
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
5731
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
5732 /*
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
5733 * 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
5734 * 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
5735 * 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
5736 * 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
5737 */
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
5738 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
5739 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5740 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
5741
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5742 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
5743 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5744 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
5745 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
5746 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
5747 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5748 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
5749 lastitem = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5750 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
5751 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5752
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5753 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5754 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5755 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5756 * 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
5757 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5758 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
5759 {
290
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
5760 dw_container_clear(handle, TRUE);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5761 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5762
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5763 /*
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
5764 * 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
5765 * 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
5766 * 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
5767 * 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
5768 */
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
5769 void API dw_tree_expand(HWND handle, HTREEITEM item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5770 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5771 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
5772 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5773
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5774 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5775 * 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
5776 * 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
5777 * 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
5778 * 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
5779 */
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
5780 void API dw_tree_collapse(HWND handle, HTREEITEM item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5781 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5782 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
5783 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5784
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5785 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5786 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5787 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5788 * 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
5789 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5790 */
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
5791 void API dw_tree_delete(HWND handle, HTREEITEM item)
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5792 {
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5793 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
5794
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5795 if(!item)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5796 return;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5797
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5798 if(pci->rc.pszIcon)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5799 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5800 free(pci->rc.pszIcon);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5801 pci->rc.pszIcon = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5802 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5803
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5804 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
5805 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5806
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5807 /* 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
5808 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
5809 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
5810 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
5811 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
5812 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5813
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5814 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5815 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5816 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5817 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5818 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5819 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5820 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5821 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5822 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5823 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5824 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5825 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5826 PFIELDINFO details, first, left = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5827 FIELDINFOINSERT detin;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5828 CNRINFO cnri;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5829 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5830 ULONG size = sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5831 ULONG *offStruct = malloc(count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5832 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
5833 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
5834 ULONG *oldflags = blah ? blah->data : 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5835
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5836 if(!offStruct || !tempflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5837 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5838
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5839 memcpy(tempflags, flags, count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5840 tempflags[count] = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5841
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
5842 blah->data = tempflags;
70
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5843 blah->flags = separator;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5844
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5845 if(oldflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5846 free(oldflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5847
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5848 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5849 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5850 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5851 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5852
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5853 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5854 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5855 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5856 offStruct[z] = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5857 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5858 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5859 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5860 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5861 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5862 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5863 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5864 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5865 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5866 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5867 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5868
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5869 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5870
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5871 if(!first)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5872 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5873 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5874 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5875 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5876
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5877 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5878 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5879 if(z==separator-1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5880 left=details;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5881 details->cb = sizeof(FIELDINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5882 details->flData = flags[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5883 details->flTitle = CFA_FITITLEREADONLY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5884 details->pTitleData = titles[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5885 details->offStruct = offStruct[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5886 details = details->pNextFieldInfo;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5887 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5888
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5889 detin.cb = sizeof(FIELDINFOINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5890 detin.fInvalidateFieldInfo = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5891 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5892 detin.cFieldInfoInsert = (ULONG)count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5893
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5894 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5895
18
f1002d51d959 Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 16
diff changeset
5896 if(count > separator && separator > 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5897 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5898 cnri.cb = sizeof(CNRINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5899 cnri.pFieldInfoLast = left;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5900 cnri.xVertSplitbar = 150;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5901
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5902 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5903 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5904
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
5905 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
5906 cnri.slBitmapOrIcon.cx = 16;
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
5907 cnri.slBitmapOrIcon.cy = 16;
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
5908
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
5909 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
5910
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5911 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5912 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5913 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5914
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5915 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5916 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5917 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5918 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5919 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5920 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5921 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5922 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5923 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5924 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5925 char **newtitles = malloc(sizeof(char *) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5926 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5927
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5928 newtitles[0] = "Icon";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5929 newtitles[1] = "Filename";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5930
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5931 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5932 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5933
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5934 memcpy(&newtitles[2], titles, sizeof(char *) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5935 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5936
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
5937 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5938
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5939 free(newtitles);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5940 free(newflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5941 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5942 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5943
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5944 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5945 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5946 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5947 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5948 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5949 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5950 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5951 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5952 unsigned long API dw_icon_load(unsigned long module, unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5953 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5954 return WinLoadPointer(HWND_DESKTOP,module,id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5955 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5956
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5957 /*
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
5958 * 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
5959 * 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
5960 * 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
5961 * 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
5962 * (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
5963 */
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
5964 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
5965 {
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
5966 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
5967
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
5968 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
5969 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
5970
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
5971 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
5972
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
5973 /* 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
5974 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
5975 {
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
5976 /* 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
5977 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
5978 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
5979 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
5980 }
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
5981 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
5982 }
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
5983
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
5984 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5985 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5986 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5987 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5988 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5989 void API dw_icon_free(unsigned long handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5990 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5991 WinDestroyPointer(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5992 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5993
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
5994 /* A "safe" WinSendMsg() that tries multiple times in case the
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
5995 * queue is blocked for one reason or another.
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
5996 */
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
5997 MRESULT _dw_send_msg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, int failure)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
5998 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
5999 MRESULT res;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6000 int z = 0;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6001
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6002 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6003 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6004 z++;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6005 if(z > 5000000)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6006 return (MRESULT)failure;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6007 dw_main_sleep(1);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6008 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6009 return res;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6010 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6011
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6012 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6013 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6014 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6015 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6016 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6017 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6018 void * API dw_container_alloc(HWND handle, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6019 {
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
6020 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
6021 ULONG *flags = wd ? wd->data : 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6022 int z, size = 0, totalsize, count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6023 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
6024 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
6025 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
6026
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6027 if(!flags || rowcount < 1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6028 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6029
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6030 while(flags[count])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6031 count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6032
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6033 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6034 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6035 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6036 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6037 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6038 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6039 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6040 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6041 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6042 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6043 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6044 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6045 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6046 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6047
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6048 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6049
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
6050 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
6051
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6052 if(!(blah = (void *)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount), 0)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6053 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6054
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6055 temp = (PRECORDCORE)blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6056
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6057 for(z=0;z<rowcount;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6058 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6059 temp->cb = totalsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6060 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6061 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6062
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 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
6064
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6065 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
6066 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
6067 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
6068
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6069 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6070 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6071
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6072 /* 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
6073 void _dw_container_set_item(HWND handle, PRECORDCORE temp, int column, int row, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6074 {
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
6075 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
6076 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
6077 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
6078 CNRINFO cnr;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6079 void *dest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6080
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6081 if(!flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6082 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6083
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6084 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
6085 return;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6086
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6087 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
6088
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6089 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6090 for(z=0;z<column;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6091 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6092 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6093 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6094 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6095 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6096 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6097 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6098 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6099 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6100 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6101 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6102 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6103
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6104 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6105
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6106 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6107 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6108
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6109 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6110
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6111 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
6112 memcpy(dest, data, sizeof(HPOINTER));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6113 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
6114 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6115 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
6116
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6117 if(*str)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6118 free(*str);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6119
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6120 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
6121 *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
6122 else
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6123 *str = NULL;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6124 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6125 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
6126 memcpy(dest, data, sizeof(ULONG));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6127 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
6128 memcpy(dest, data, sizeof(CDATE));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6129 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
6130 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
6131 }
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
6132
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
6133 /* 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
6134 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
6135 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6136 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
6137 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
6138 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
6139
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6140 if(!flags)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6141 return;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6142
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6143 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
6144 count++;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6145
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6146 /* 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
6147 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
6148 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6149 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
6150 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
6151 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
6152 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6153 char **str;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6154
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6155 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
6156
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6157 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
6158
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6159 if(*str)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6160 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6161 free(*str);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6162 *str = NULL;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6163 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6164 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
6165 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6166 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
6167 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
6168 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
6169 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
6170 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
6171 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
6172 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6173 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6174
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6175 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6176 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6177 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6178 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6179 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6180 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6181 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6182 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6183 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6184 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
6185 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6186 ContainerInfo *ci = (ContainerInfo *)pointer;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6187
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6188 if(!ci)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6189 return;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6190
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6191 _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
6192 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6193
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6194 /*
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6195 * 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
6196 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6197 * 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
6198 * 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
6199 * 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
6200 * 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
6201 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6202 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
6203 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6204 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
6205 int count = 0;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6206
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6207 while(pCore)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6208 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6209 if(count == row)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6210 {
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6211 _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
6212 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
6213 return;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6214 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6215 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
6216 count++;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6217 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6218 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6219
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6220 /*
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6221 * 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
6222 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6223 * 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
6224 * 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
6225 * 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
6226 * 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
6227 * 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
6228 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6229 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6230 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6231 dw_container_set_item(handle, pointer, 0, row, (void *)&icon);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6232 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6233 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6234
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6235 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6236 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6237 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6238 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6239 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6240 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6241 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6242 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6243 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6244 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6245 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6246 dw_container_set_item(handle, pointer, column + 2, row, data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6247 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6248
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6249 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6250 * 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
6251 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6252 * 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
6253 * 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
6254 * 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
6255 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6256 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
6257 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6258 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6259
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6260 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6261 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6262 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6263 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6264 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6265 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6266 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6267 void API dw_container_set_row_title(void *pointer, int row, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6268 {
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6269 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
6270 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
6271 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
6272 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
6273
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6274 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6275 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6276
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
6277 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
6278
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
6279 z = 0;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
6280
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6281 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
6282 return;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6283
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6284 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
6285
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6286 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6287 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6288
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6289 temp->pszIcon = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6290 temp->pszName = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6291 temp->pszText = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6292 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6294 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6295 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6296 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6297 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6298 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6299 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6300 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6301 void API dw_container_insert(HWND handle, void *pointer, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6302 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6303 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
6304 ContainerInfo *ci = (ContainerInfo *)pointer;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6305
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6306 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6307 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6308
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6309 recin.cb = sizeof(RECORDINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6310 recin.pRecordOrder = (PRECORDCORE)CMA_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6311 recin.pRecordParent = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6312 recin.zOrder = CMA_TOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6313 recin.fInvalidateRecord = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6314 recin.cRecordsInsert = rowcount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6315
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6316 _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
6317
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6318 free(ci);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6319 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6320
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6321 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6322 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6323 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6324 * 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
6325 * 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
6326 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6327 void API dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6328 {
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6329 PCNRITEM pCore;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6330 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
6331
315
89eac0990c67 Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 314
diff changeset
6332 if(hwndEmph == handle)
89eac0990c67 Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 314
diff changeset
6333 _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
6334
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6335 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
6336
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6337 while(pCore)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6338 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6339 if(container)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6340 _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
6341 else
290
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6342 {
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6343 /* Free icon text */
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6344 if(pCore->rc.pszIcon)
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6345 {
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6346 free(pCore->rc.pszIcon);
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6347 pCore->rc.pszIcon = 0;
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6348 }
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6349 }
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6350 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6351 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6352 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE), -1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6353 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6354
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6355 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6356 * 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
6357 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6358 * 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
6359 * 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
6360 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6361 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
6362 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6363 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
6364 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
6365
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6366 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
6367
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6368 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
6369 {
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6370 _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
6371 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
6372 current++;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6373 }
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
6374
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6375 _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
6376
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6377 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
6378 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6379
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6380 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6381 * 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
6382 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6383 * 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
6384 * 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
6385 * 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
6386 * 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
6387 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6388 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
6389 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6390 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
6391 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6392 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
6393 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
6394 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6395 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
6396 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
6397 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6398 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6399 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6400
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6401 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6402 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6403 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6404 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6405 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6406 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6407 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6408 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6409 char * API dw_container_query_start(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6410 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6411 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6412 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6413 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6414 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6415 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6416 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6417 {
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6418 if(pCore->flRecordAttr & flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6419 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6420 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6421 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6422 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6423 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6424 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6425 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6426 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6427 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6428
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6429 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6430 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6431 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6432 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6433 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6434 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6435 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6436 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6437 char * API dw_container_query_next(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6438 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6439 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6440 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6441 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6442 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6443 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6444 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6445 {
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6446 if(pCore->flRecordAttr & flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6447 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6448
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6449 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6450 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6451 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6452 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6453 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6454 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6455 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6456 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6457
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6458 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6459 * 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
6460 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6461 * 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
6462 * 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
6463 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6464 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
6465 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6466 RECTL viewport, item;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6467
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6468 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6469 while(pCore)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6470 {
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
6471 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
6472 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6473 QUERYRECORDRECT qrr;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6474 int scrollpixels = 0, midway;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6475
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6476 qrr.cb = sizeof(QUERYRECORDRECT);
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6477 qrr.pRecord = pCore;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6478 qrr.fRightSplitWindow = 0;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6479 qrr.fsExtent = CMA_TEXT;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6480
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6481 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
6482 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
6483 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
6484
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6485 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
6486 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
6487
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6488 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
6489 return;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6490 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6491
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6492 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
6493 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6494 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6495
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6496 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6497 * 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
6498 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6499 * 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
6500 * 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
6501 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6502 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
6503 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6504 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
6505
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6506 while(pCore)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6507 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6508 if((char *)pCore->pszIcon == text)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6509 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6510 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
6511 return;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6512 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6513 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
6514 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6515 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6516
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6517 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6518 * 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
6519 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6520 * 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
6521 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6522 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
6523 {
70
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6524 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
6525 RECTL item;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6526 PRECORDCORE pCore = NULL;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6527 int max = 0;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6528
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6529 if(blah && !blah->flags)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6530 return;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6531
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6532 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
6533 while(pCore)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6534 {
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6535 QUERYRECORDRECT qrr;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6536 int vector;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6537
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6538 qrr.cb = sizeof(QUERYRECORDRECT);
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6539 qrr.pRecord = pCore;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6540 qrr.fRightSplitWindow = 0;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6541 qrr.fsExtent = CMA_TEXT;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6542
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6543 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
6544
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6545 vector = item.xRight - item.xLeft;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6546
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6547 if(vector > max)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6548 max = vector;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6549
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6550 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
6551 }
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6552
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6553 if(max)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6554 {
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6555 CNRINFO cnri;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6556
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6557 cnri.cb = sizeof(CNRINFO);
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6558 cnri.xVertSplitbar = max;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6559
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6560 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
6561 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6562 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6563
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6564 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6565 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6566 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6567 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6568 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6569 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6570 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6571 HWND API dw_render_new(unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6572 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6573 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6574 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6575 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
6576 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
6577 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6578 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6579 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6580 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6581 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6582 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6583 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6584 WinSubclassWindow(hwndframe, _RendProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6585 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6586 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6587
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6588 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6589 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6590 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6591 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6592 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6593 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6594 void API dw_color_foreground_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6595 {
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
6596 _foreground = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6597 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6598
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6599 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6600 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6601 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6602 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6603 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6604 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6605 void API dw_color_background_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6606 {
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
6607 _background = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6608 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6609
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6610 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6611 {
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
6612 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
6613
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
6614 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
6615 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6616
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6617 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
6618 LCOL_RESET,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6619 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
6620 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
6621 2,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6622 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
6623 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
6624 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
6625 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
6626 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
6627 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
6628 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
6629 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
6630 GpiSetBackColor(hps, _internal_color(_background));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6631 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6632 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6633
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6634 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6635 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6636 HPS hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6637
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6638 _set_hps(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6639 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6640 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6641
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6642 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6643 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6644 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6645 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6646 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6647 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6648 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6649 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6650 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6651 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6652 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6653 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6654
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6655 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6656 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6657 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6658 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6659 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6660 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6661 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6662 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6663 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6664 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6665 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6666 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6667
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6668 ptl.x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6669 ptl.y = height - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6670
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6671 GpiSetPel(hps, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6672 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6673 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6674 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6676 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6677 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6678 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6679 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6680 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6681 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6682 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6683 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6684 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6685 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6686 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6687 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6688 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6689 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6690
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6691 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6692 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6693 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6694 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6695 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6696 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6697 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6698 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6699 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6700 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6701 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6702 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6703
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6704 ptl[0].x = x1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6705 ptl[0].y = height - y1 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6706 ptl[1].x = x2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6707 ptl[1].y = height - y2 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6708
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6709 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6710 GpiLine(hps, &ptl[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6711
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6712 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6713 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6714 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6715
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6716
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6717 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
6718 {
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6719 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
6720 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
6721 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
6722
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6723 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
6724
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6725 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
6726
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6727 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
6728 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
6729 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
6730
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6731 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
6732 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
6733
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6734 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
6735 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
6736 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
6737 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6738
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6739 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6740 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6741 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6742 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6743 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6744 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6745 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6746 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6747 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6748 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6749 HPS hps;
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
6750 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
6751 RECTL rcl;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6752 char fontname[128];
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
6753 POINTL aptl[TXTBOX_COUNT];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6754
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6755 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6756 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6757 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6758 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6759 _GetPPFont(handle, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6760 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6761 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6762 {
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6763 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
6764
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6765 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6766 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6767 _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
6768 _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
6769 WinReleasePS(pixmaphps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6770 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6771 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6772 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6773
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6774 for(z=0;z<strlen(fontname);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6775 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6776 if(fontname[z]=='.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6777 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6778 }
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
6779
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
6780 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6781
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6782 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
6783 rcl.yTop = height - y;
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
6784 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
6785 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
6786
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6787 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6788
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6789 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6790 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6791 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6792
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
6793 /* 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
6794 * 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
6795 * 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
6796 * 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
6797 * 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
6798 * 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
6799 * 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
6800 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6801 void API dw_font_text_extents(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height)
49
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6802 {
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
6803 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
6804 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
6805
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
6806 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
6807 {
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
6808 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
6809 }
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
6810 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
6811 {
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
6812 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
6813
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
6814 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
6815 _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
6816 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
6817 }
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
6818 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
6819 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
6820
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
6821 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
6822
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
6823 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
6824 *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
6825
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
6826 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
6827 *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
6828
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
6829 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
6830 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
6831 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6832
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6833 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6834 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6835 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6836 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6837 * fill: Fill box TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6838 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6839 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6840 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6841 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6842 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6843 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6844 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6845 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6846 int thisheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6847 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6848
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6849 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6850 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6851 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6852 thisheight = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6853 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6854 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6855 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6856 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6857 thisheight = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6858 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6859 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6860 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6861
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6862 ptl[0].x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6863 ptl[0].y = thisheight - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6864 ptl[1].x = x + width - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6865 ptl[1].y = thisheight - y - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6866
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6867 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6868 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6869
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6870 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6871 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6872 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6873
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6874 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6875 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6876 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6877 void API dw_flush(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6878 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6879 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6880
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6881 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6882 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6883 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6884 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6885 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6886 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6887 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6888 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6889 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6890 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6891 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6892 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6893 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6894 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6895 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6896 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6897 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6898 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6899 LONG cPlanes, cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6900
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6901 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6902 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6903
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6904 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6905
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6906 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6907 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6908
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6909 pixmap->handle = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6910 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6911 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6912
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6913 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6914 if (!depth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6915 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6916 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6917 depth = cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6918 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6919
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6920 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6921 bmih.cbFix = sizeof(BITMAPINFOHEADER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6922 bmih.cx = (SHORT)width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6923 bmih.cy = (SHORT)height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6924 bmih.cPlanes = (SHORT)cPlanes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6925 bmih.cBitCount = (SHORT)depth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6926
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6927 pixmap->width = width; pixmap->height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6928
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6929 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6930
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6931 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6932
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6933 if (depth>8)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6934 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6935
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6936 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6937
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6938 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6939 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6940
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6941 /*
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6942 * Creates a pixmap from a file.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6943 * Parameters:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6944 * 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
6945 * 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
6946 * DW pick the appropriate file extension.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6947 * (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
6948 * Returns:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6949 * 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
6950 */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6951 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
6952 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6953 HPIXMAP pixmap;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6954 char *file = alloca(strlen(filename) + 5);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6955
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6956 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
6957 return NULL;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6958
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6959 strcpy(file, filename);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6960
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6961 /* 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
6962 if(access(file, 04) != 0)
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6963 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6964 /* Try with .bmp extention */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6965 strcat(file, ".bmp");
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6966 if(access(file, 04) != 0)
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6967 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6968 free(pixmap);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6969 return NULL;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6970 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6971 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6972
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6973 /* 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
6974 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
6975 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6976 free(pixmap);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6977 return NULL;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6978 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6979
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6980 /* Success fill in other values */
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6981 pixmap->handle = handle;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6982
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6983 return pixmap;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6984 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6985
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
6986 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6987 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6988 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6989 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6990 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6991 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6992 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6993 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6994 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6995 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6996 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6997 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6998 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6999 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7000 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7001 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7002
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7003 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7004 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7005
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7006 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7007
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7008 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7009 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7010
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7011 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7012 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7013
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7014 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7016 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7017
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7018 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7019
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7020 pixmap->width = bmih.cx; pixmap->height = bmih.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7021
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7022 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7023
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7024 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7025 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7026
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7027 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7028 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7029 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7030 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7031 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7032 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7033 void API dw_pixmap_destroy(HPIXMAP pixmap)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7034 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7035 GpiSetBitmap(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7036 GpiDeleteBitmap(pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7037 GpiAssociate(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7038 GpiDestroyPS(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7039 DevCloseDC(pixmap->hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7040 free(pixmap);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7041 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7042
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7043 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7044 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7045 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7046 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7047 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7048 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7049 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7050 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7051 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7052 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7053 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7054 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7055 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7056 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7057 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
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7058 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7059 HPS hpsdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7060 HPS hpssrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7061 POINTL ptl[4];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7062 int destheight, srcheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7063
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7064 if(dest)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7065 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7066 hpsdest = WinGetPS(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7067 destheight = _get_height(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7068 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7069 else if(destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7070 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7071 hpsdest = destp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7072 destheight = destp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7073 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7074 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7075 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7076
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7077 if(src)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7078 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7079 hpssrc = WinGetPS(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7080 srcheight = _get_height(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7081 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7082 else if(srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7083 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7084 hpssrc = srcp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7085 srcheight = srcp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7086 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7087 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7088 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7089 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7090 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7091 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7092 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7093
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7094 ptl[0].x = xdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7095 ptl[0].y = (destheight - ydest) - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7096 ptl[1].x = ptl[0].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7097 ptl[1].y = destheight - ydest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7098 ptl[2].x = xsrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7099 ptl[2].y = srcheight - (ysrc + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7100 ptl[3].x = ptl[2].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7101 ptl[3].y = ptl[2].y + height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7102
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7103 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7104
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7105 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7106 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7107 if(!srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7108 WinReleasePS(hpssrc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7109 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7110
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7111 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7112 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7113 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7114 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7115 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7116 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7117 void API dw_beep(int freq, int dur)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7118 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7119 DosBeep(freq, dur);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7120 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7121
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7122 /* Open a shared library and return a handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7123 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7124 * name: Base name of the shared library.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7125 * handle: Pointer to a module handle,
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7126 * will be filled in with the handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7127 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7128 int API dw_module_load(char *name, HMOD *handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7129 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7130 char objnamebuf[300] = "";
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7131
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7132 return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7133 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7134
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7135 /* Queries the address of a symbol within open handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7136 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7137 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7138 * name: Name of the symbol you want the address of.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7139 * func: A pointer to a function pointer, to obtain
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7140 * the address.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7141 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7142 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
7143 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7144 return DosQueryProcAddr(handle, 0, name, (PFN*)func);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7145 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7146
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7147 /* Frees the shared library previously opened.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7148 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7149 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7150 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7151 int API dw_module_close(HMOD handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7152 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7153 DosFreeModule(handle);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7154 return 0;
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7155 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7156
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7157 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7158 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7159 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7160 HMTX API dw_mutex_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7161 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7162 HMTX mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7163
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7164 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7165 return mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7166 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7167
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7168 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7169 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7170 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7171 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7172 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7173 void API dw_mutex_close(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7174 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7175 DosCloseMutexSem(mutex);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7176 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7177
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7178 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7179 * 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
7180 * 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
7181 * while blocking.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7182 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7183 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7184 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7185 void API dw_mutex_lock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7186 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7187 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
7188 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7189 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
7190
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7191 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
7192 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7193 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
7194 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
7195 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7196 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7197 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7198 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7199 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7200
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7201 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7202 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7203 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7204 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7205 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7206 void API dw_mutex_unlock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7207 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7208 DosReleaseMutexSem(mutex);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7209 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7210
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7211 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7212 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7213 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7214 HEV API dw_event_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7215 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7216 HEV blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7217
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7218 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7219 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7220
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7221 return blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7222 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7223
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7224 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7225 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7226 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7227 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7228 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7229 int API dw_event_reset(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7230 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7231 ULONG count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7232
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7233 if(DosResetEventSem(eve, &count))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7234 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7235 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7236 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7237
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7238 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7239 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7240 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7241 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7242 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7243 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7244 int API dw_event_post(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7245 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7246 if(DosPostEventSem(eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7247 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7248 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7249 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7250
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7251
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7252 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7253 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7254 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7255 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7256 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7257 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7258 int API dw_event_wait(HEV eve, unsigned long timeout)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7259 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7260 int rc = DosWaitEventSem(eve, timeout);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7261 if(!rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7262 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7263 if(rc == ERROR_TIMEOUT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7264 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7265 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7266 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7267
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7268 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7269 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7270 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7271 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7272 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7273 int API dw_event_close(HEV *eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7274 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7275 if(!eve || ~DosCloseEventSem(*eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7276 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7277 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7278 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7279
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7280 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7281 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7282 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7283 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7284 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7285 HAB thishab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7286 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7287 void (*threadfunc)(void *) = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7288 void **tmp = (void **)data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7289
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7290 threadfunc = (void (*)(void *))tmp[0];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7291 threadfunc(tmp[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7292
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7293 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7294
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7295 WinDestroyMsgQueue(thishmq);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7296 WinTerminate(thishab);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7297 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7298
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7299 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7300 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7301 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7302 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7303 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7304 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7305 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7306 DWTID API dw_thread_new(void *func, void *data, int stack)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7307 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7308 void **tmp = malloc(sizeof(void *) * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7309
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7310 tmp[0] = func;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7311 tmp[1] = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7312
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7313 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7314 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7315
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7316 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7317 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7318 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7319 void API dw_thread_end(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7320 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7321 _endthread();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7322 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7323
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7324 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7325 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7326 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7327 DWTID API dw_thread_id(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7328 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7329 return (DWTID)_threadid;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7330 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7331
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7332 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7333 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7334 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7335 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7336 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7337 void API dw_exit(int exitcode)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7338 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7339 /* In case we are in a signal handler, don't
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7340 * try to free memory that could possibly be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7341 * free()'d by the runtime already.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7342 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7343 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
7344
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7345 exit(exitcode);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7346 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7347
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7348 /*
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
7349 * 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
7350 * 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
7351 * 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
7352 * 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
7353 * 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
7354 * 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
7355 * 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
7356 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7357 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
7358 {
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7359 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
7360 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
7361 NULL,
137
6a18312049fd The splitbar needs to have the WS_CLIPCHILDREN style set.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 136
diff changeset
7362 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
7363 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
7364 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
7365 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
7366 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
7367 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
7368 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
7369 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
7370 {
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
7371 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
7372 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
7373
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7374 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
7375 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
7376 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
7377
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
7378 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
7379 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
7380 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
7381 *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
7382 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
7383 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
7384 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
7385 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7386 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
7387 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7388
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7389 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7390 * 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
7391 * 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
7392 * 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
7393 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7394 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
7395 {
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
7396 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
7397 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
7398 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
7399
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
7400 if(mypercent)
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
7401 *mypercent = percent;
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
7402
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
7403 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
7404
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
7405 _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
7406 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7407
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7408 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7409 * 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
7410 * 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
7411 * 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
7412 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7413 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
7414 {
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
7415 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
7416
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
7417 if(percent)
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
7418 return *percent;
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
7419 return 0.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7420 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7421
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7422 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7423 * Pack windows (widgets) into a box from the start (or top).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7424 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7425 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7426 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7427 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7428 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7429 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7430 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7431 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7432 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7433 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7434 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7435 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7436
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7437 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7438 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7439 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7440 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7441 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7442 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7443 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7444 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7445 {
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
7446 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7447 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7448 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7449 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7450 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7451 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7452
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7453 void dw_box_pack_start_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7454 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7455 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7456
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7457 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7458 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7459 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7460 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7461 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7462 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7463 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7464 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7465 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7466 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7467 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7468 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7469 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7470 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7471
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7472 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7473
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7474 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7475 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7476 tmpitem[z+1] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7477 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7478
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7479 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7480
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
7481 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
7482 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
7483 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
7484 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
7485
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
7486 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7487 tmpitem[0].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7488 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7489 tmpitem[0].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7490
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7491 tmpitem[0].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7492 tmpitem[0].origwidth = tmpitem[0].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7493 tmpitem[0].origheight = tmpitem[0].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7494 tmpitem[0].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7495 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7496 tmpitem[0].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7497 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7498 tmpitem[0].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7499
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7500 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7501 tmpitem[0].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7502 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7503 tmpitem[0].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7504
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7505 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7506
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7507 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7508 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7509
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7510 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7511
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7512 WinQueryClassName(item, 99, tmpbuf);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
7513 /* Don't set the ownership if it's an entryfield or spinbutton */
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7514 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0)
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7515 WinSetOwner(item, box);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7516 WinSetParent(item, box, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7517 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7518 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7519
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7520 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7521 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7522 char* pchStart = pchBuffer;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7523 char* pchEnd = pchStart + ulSize - 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7524
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7525 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7526 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7527 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7528 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7529 *pchEnd-- = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7530 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7531 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7532 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7533 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7534 ULONG ulMajor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7535 ULONG ulMinor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7536
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7537 char* pch = pchEnd + 2;
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
7538 while (!isdigit ((int)*pch) && *pch)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7539 pch++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7540
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
7541 while (isdigit ((int)*pch))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7542 ulMajor = ulMajor * 10 + *pch++ - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7543
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7544 if (*pch == '.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7545 {
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
7546 while (isdigit ((int)*++pch))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7547 ulMinor = ulMinor * 10 + *pch - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7548 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7549 return ((ulMajor << 16) | ulMinor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7550 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7551 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7552 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7553 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7554 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7555 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7556 return (0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7557 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7558
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7559 ULONG _GetSystemBuildLevel(void) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7560 /* 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.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7561 * 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.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7562 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7563 ULONG ulBootDrive = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7564 ULONG ulBuild = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7565 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7566 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7567 char achFileName[11] = "C:\\OS2KRNL";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7568 HFILE hfile;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7569 ULONG ulResult;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7570
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7571 achFileName[0] = (char)('A'+ulBootDrive-1);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7572
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7573 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)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7574 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7575 ULONG ulFileSize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7576 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7577 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7578 const ULONG ulFirstTry = min (256, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7579 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7580 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7581 char *pchBuffer = malloc(ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7582 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7583 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7584 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7585 if (ulBuild == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7586 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7587 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7588 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7589 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7590 pchBuffer = malloc(ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7591
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7592 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7593 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7594 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7595 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7596 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7597 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7598 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7599 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7600 DosClose (hfile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7601 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7602 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7603 return (ulBuild);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7604 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7605
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
7606 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
7607 * 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
7608 * 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
7609 * 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
7610 * 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
7611 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7612 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
7613 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
7614 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
7615 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
7616
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
7617 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
7618 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
7619 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
7620
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
7621 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
7622 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
7623 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7624
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7625 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
7626 * 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
7627 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
7628 * 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
7629 * 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
7630 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7631 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
7632 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
7633 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
7634
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
7635 if(blah)
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
7636 blah->clickdefault = next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
7637 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
7638
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
7639 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7640 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7641 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7642 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7643 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7644 void API dw_environment_query(DWEnv *env)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7645 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7646 ULONG Build;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7647
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7648 if(!env)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7649 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7650
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7651 /* The default is OS/2 2.0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7652 strcpy(env->osName,"OS/2");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7653 env->MajorVersion = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7654 env->MinorVersion = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7655
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7656 Build = _GetSystemBuildLevel();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7657 env->MinorBuild = Build & 0xFFFF;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7658 env->MajorBuild = Build >> 16;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7659
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7660 if (aulBuffer[0] == 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7661 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7662 int i = (unsigned int)aulBuffer[1];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7663 if (i > 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7664 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7665 strcpy(env->osName,"Warp");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7666 env->MajorVersion = (int)i/10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7667 env->MinorVersion = i-(((int)i/10)*10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7668 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7669 else if (i == 10)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7670 env->MinorVersion = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7671 }
15
81833f25b1aa Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 14
diff changeset
7672 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
7673 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
7674 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
7675 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
7676 env->DWSubVersion = DW_SUB_VERSION;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7677 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7678
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7679 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7680 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7681 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7682 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7683 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7684 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7685 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7686 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7687 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7688 * the file path on success.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7689 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7690 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7691 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7692 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7693 FILEDLG fild;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7694 HWND hwndFile;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7695 int len;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7696
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7697 if(defpath)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7698 strcpy(fild.szFullFile, defpath);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7699 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7700 strcpy(fild.szFullFile, "");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7701
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7702 len = strlen(fild.szFullFile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7703
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7704 if(len)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7705 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7706 if(fild.szFullFile[len-1] != '\\')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7707 strcat(fild.szFullFile, "\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7708 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7709 strcat(fild.szFullFile, "*");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7710
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7711 if(ext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7712 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7713 strcat(fild.szFullFile, ".");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7714 strcat(fild.szFullFile, ext);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7715 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7716
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7717 fild.cbSize = sizeof(FILEDLG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7718 fild.fl = /*FDS_HELPBUTTON |*/ FDS_CENTER | FDS_OPEN_DIALOG;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7719 fild.pszTitle = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7720 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7721 fild.ulUser = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7722 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7723 fild.lReturn = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7724 fild.lSRC = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7725 fild.hMod = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7726 fild.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7727 fild.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7728 fild.pszIType = (PSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7729 fild.papszITypeList = (PAPSZ)NULL;
236
5592cdeb29cf Make sure all platforms have the same typedefs.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 235
diff changeset
7730 fild.pszIDrive = (PSZ)NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7731 fild.papszIDriveList= (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7732 fild.sEAType = (SHORT)0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7733 fild.papszFQFilename= (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7734 fild.ulFQFCount = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7735
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7736 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7737 if(hwndFile)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7738 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7739 switch(fild.lReturn)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7740 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7741 case DID_OK:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7742 return strdup(fild.szFullFile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7743 case DID_CANCEL:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7744 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7745 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7746 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7747 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7748 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7749
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7750 /* 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
7751 int _SetPath(char *path)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7752 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7753 #ifndef __WATCOMC__
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7754 if(strlen(path) > 2)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7755 {
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7756 if(path[1] == ':')
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7757 {
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7758 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
7759 _chdrive((drive - 'A')+1);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7760 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7761 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7762 #endif
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7763 return chdir(path);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7764 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7765
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7766 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7767 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7768 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7769 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7770 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7771 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7772 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7773 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7774 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7775 int API dw_exec(char *program, int type, char **params)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7776 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7777 return spawnvp(P_NOWAIT, program, (const char **)params);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7778 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7779
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7780 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7781 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7782 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7783 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7784 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7785 int API dw_browse(char *url)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7786 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7787 /* Is there a way to find the webbrowser in Unix? */
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7788 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
7789 int len, ret;
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7790
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7791 olddir = _getcwd(NULL, 1024);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7792
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7793 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS",
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7794 "DefaultWorkingDir", NULL, browser, 1024);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7795
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7796 if(browser[0])
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7797 _SetPath(browser);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7798
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7799 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7800 "DefaultBrowserExe", NULL, browser, 1024);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7801
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7802 len = strlen(browser) - strlen("explore.exe");
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7803
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7804 execargs[0] = browser;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7805 execargs[1] = url;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7806 execargs[2] = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7807
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7808 /* 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
7809 * 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
7810 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7811 if(len > 0)
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7812 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7813 if(stricmp(&browser[len], "explore.exe") == 0)
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7814 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7815 int newlen, z;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7816 newurl = malloc(strlen(url) + 2);
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7817 sprintf(newurl, "file:///%s", &url[7]);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7818 newlen = strlen(newurl);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7819 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
7820 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7821 if(newurl[z] == '|')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7822 newurl[z] = ':';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7823 if(newurl[z] == '/')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7824 newurl[z] = '\\';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7825 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7826 execargs[1] = newurl;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7827 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7828 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7829
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7830 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
7831
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7832 if(olddir)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7833 {
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7834 _SetPath(olddir);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7835 free(olddir);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7836 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7837 if(newurl)
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
7838 free(newurl);
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
7839 return ret;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7840 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7841
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7842 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7843 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7844 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7845 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7846 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7847 char * API dw_user_dir(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7848 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7849 static char _user_dir[1024] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7850
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7851 if(!_user_dir[0])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7852 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7853 char *home = getenv("HOME");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7854
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7855 if(home)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7856 strcpy(_user_dir, home);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7857 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7858 strcpy(_user_dir, "C:\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7859 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7860 return _user_dir;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7861 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7862
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7863 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7864 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7865 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7866 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7867 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7868 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7869 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7870 void API dw_window_function(HWND handle, void *function, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7871 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7872 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7873 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7874
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7875 /* 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
7876 * 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
7877 * 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
7878 */
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7879 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
7880 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7881 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
7882
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7883 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
7884 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7885 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
7886 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
7887 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
7888 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7889 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
7890 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7891
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7892 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
7893 {
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7894 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
7895
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7896 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
7897 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7898 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
7899 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
7900 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7901 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7902 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7903 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
7904 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
7905 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7906 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
7907 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
7908
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7909 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
7910
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7911 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
7912 *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
7913 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7914 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7915 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
7916 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
7917 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7918 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
7919 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
7920 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7921 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
7922 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
7923 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7924 *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
7925 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7926 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
7927 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7928 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7929 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
7930 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7931
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7932 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
7933 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7934 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
7935
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7936 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
7937 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7938 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
7939 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7940 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
7941 {
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
7942 *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
7943 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
7944 free(tmp);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7945 if(!all)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7946 return 0;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7947 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
7948 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7949 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7950 {
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7951 /* If all is true we should
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7952 * never get here.
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7953 */
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7954 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
7955 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
7956 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
7957 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
7958 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7959 }
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7960 else
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7961 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7962 prev = tmp;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7963 tmp = tmp->next;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7964 }
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7965 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7966 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
7967 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7968
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7969 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7970 * 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
7971 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7972 * 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
7973 * 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
7974 * 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
7975 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7976 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
7977 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7978 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
7979
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
7980 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
7981 {
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7982 if(!dataname)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7983 return;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
7984
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
7985 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
7986 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
7987 }
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
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 if(data)
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7990 _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
7991 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
7992 {
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
7993 if(dataname)
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7994 _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
7995 else
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
7996 _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
7997 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7998 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7999
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8000 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8001 * 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
8002 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8003 * 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
8004 * 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
8005 * 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
8006 */
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8007 void *dw_window_get_data(HWND window, char *dataname)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8008 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8009 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
8010
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8011 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
8012 {
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
8013 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
8014 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
8015 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
8016 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8017 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
8018 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
8019
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8020 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8021 * 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
8022 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8023 * 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
8024 * 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
8025 * 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
8026 * Returns:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8027 * 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
8028 */
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
8029 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
8030 {
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
8031 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
8032 {
289
0e6f09149eaa Fixed some EMX warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 283
diff changeset
8033 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
8034
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
8035 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
8036 {
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
8037 _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
8038 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
8039 }
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8040 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8041 return 0;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8042 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8043
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8044 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8045 * Removes timer callback.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8046 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8047 * 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
8048 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8049 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
8050 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8051 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
8052
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8053 /* 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
8054 if(!id)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8055 return;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8056
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
8057 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
8058
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8059 while(tmp)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8060 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8061 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
8062 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8063 if(prev)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8064 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8065 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
8066 free(tmp);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8067 tmp = prev->next;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8068 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8069 else
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8070 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8071 Root = tmp->next;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8072 free(tmp);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8073 tmp = Root;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8074 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8075 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8076 else
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8077 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8078 prev = tmp;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8079 tmp = tmp->next;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8080 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8081 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8082 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8083
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8084 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8085 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8086 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8087 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8088 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8089 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8090 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8091 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8092 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8093 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8094 ULONG message = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8095
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8096 if(window && signame && sigfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8097 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8098 if((message = _findsigmessage(signame)) != 0)
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8099 _new_signal(message, window, 0, sigfunc, data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8100 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8101 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8102
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8103 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8104 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8105 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8106 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8107 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8108 void API dw_signal_disconnect_by_name(HWND window, char *signame)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8109 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8110 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8111 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8112
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8113 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8114 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8115
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8116 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8117 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8118 if(tmp->window == window && tmp->message == message)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8119 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8120 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8121 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8122 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8123 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8124 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8125 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8126 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8127 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8128 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8129 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8130 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8131 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8132 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8133 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8134 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8135 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8136 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8137 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8138 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8139 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8140
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8141 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8142 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8143 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8144 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8145 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8146 void API dw_signal_disconnect_by_window(HWND window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8147 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8148 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8149
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8150 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8151 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8152 if(tmp->window == window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8153 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8154 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8155 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8156 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8157 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8158 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8159 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8160 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8161 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8162 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8163 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8164 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8165 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8166 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8167 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8168 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8169 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8170 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8171 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8172 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8173 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8174
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8175 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8176 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8177 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8178 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8179 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8180 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8181 void API dw_signal_disconnect_by_data(HWND window, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8182 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8183 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8184
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8185 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8186 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8187 if(tmp->window == window && tmp->data == data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8188 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8189 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8190 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8191 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8192 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8193 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8194 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8195 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8196 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8197 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8198 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8199 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8200 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8201 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8202 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8203 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8204 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8205 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8206 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8207 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8208 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8209
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
8210