annotate os2/dw.c @ 94:7c3eef54c98c

Popup menu handler fix for GTK, and fixed sliders/percent widgets not being accurate after a resize. Also removed a limitation in the click default code.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 09 May 2002 06:31:48 +0000
parents 98cce029a611
children 24cf41bb75ff
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 *
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5 * (C) 2000-2002 Brian Smith <dbsoft@technologist.com>
3
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>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
25 #include "dw.h"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
26
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
27 #define QWP_USER 0
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
28
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
29 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
30 void _do_resize(Box *thisbox, int x, int y);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
31
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
32 char ClassName[] = "dynamicwindows";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
33 char SplitbarClassName[] = "dwsplitbar";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
34 char DefaultFont[] = "9.WarpSans";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
35
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
36 /* this is the callback handle for the window procedure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
37 * make sure you always match the calling convention!
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
38 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
39 int (* EXPENTRY filterfunc)(HWND, ULONG, MPARAM, MPARAM) = 0L;
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
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
46 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
47 PRECORDCORE pCore = NULL;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
48 ULONG aulBuffer[4];
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
49 HWND lasthcnr = 0, lastitem = 0, popup = 0;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
50
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
51 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
52
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
53 #ifndef min
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
54 #define min(a, b) (((a < b) ? a : b))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
55 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
56
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
57 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
58 FILE *f;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
59
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
60 void reopen(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
61 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
62 fclose(f);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
63 f = fopen("dw.log", "a+");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
64 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
65 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
66
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
67 static LONG lColor[SPLITBAR_WIDTH] =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
68 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
69 DW_CLR_BLACK,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
70 DW_CLR_PALEGRAY,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
71 DW_CLR_WHITE
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
72 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
73
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
74 #ifdef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
75 #define USE_FILTER
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
76 #else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
77 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
78 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
79 struct _sighandler *next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
80 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
81 HWND window;
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 */
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
97 #define SIGNALMAX 15
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
98
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
99 SignalList SignalTranslate[SIGNALMAX] = {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
100 { WM_SIZE, "configure_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
101 { WM_CHAR, "key_press_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
102 { WM_BUTTON1DOWN, "button_press_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
103 { WM_BUTTON1UP, "button_release_event"},
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
104 { WM_MOUSEMOVE, "motion_notify_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
105 { WM_CLOSE, "delete_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
106 { WM_PAINT, "expose_event" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
107 { WM_COMMAND, "clicked" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
108 { CN_ENTER, "container-select" },
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
109 { CN_CONTEXTMENU, "container-context" },
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
110 { LN_SELECT, "item-select" },
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
111 { CN_EMPHASIS, "tree-select" },
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
112 { WM_SETFOCUS, "set-focus" },
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
113 { WM_USER+1, "lose-focus" },
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
114 { SLN_SLIDERTRACK, "value_changed" }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
115 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
116
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
117 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
118 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
119 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
120 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
121 SignalHandler *new = malloc(sizeof(SignalHandler));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
122
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
123 #ifndef NO_SIGNALS
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
124 if(message == WM_COMMAND)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
125 dw_signal_disconnect_by_window(window);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
126 #endif
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
127
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
128 new->message = message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
129 new->window = window;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
130 new->signalfunction = signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
131 new->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
132 new->next = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
133
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
134 if (!Root)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
135 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
136 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
137 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
138 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
139 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
140 {
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
141 if(tmp->message == message &&
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
142 tmp->window == window &&
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
143 tmp->signalfunction == signalfunction)
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
144 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
145 tmp->data = data;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
146 free(new);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
147 return;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
148 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
149 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
150 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
151 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
152 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
153 prev->next = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
154 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
155 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
156 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
157 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
158
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
159 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
160 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
161 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
162 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
163
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
164 for(z=0;z<SIGNALMAX;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
165 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
166 if(stricmp(signame, SignalTranslate[z].name) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
167 return SignalTranslate[z].message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
168 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
169 return 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
170 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
171 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
172
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
173 typedef struct _CNRITEM
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
174 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
175 MINIRECORDCORE rc;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
176 HPOINTER hptrIcon;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
177 PVOID user;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
178
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
179 } CNRITEM, *PCNRITEM;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
180
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
181
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
182 /* Find the desktop window handle */
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
183 HWND _toplevel_window(HWND handle)
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
184 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
185 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT);
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
186
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
187 /* Find the toplevel window */
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
188 while((box = WinQueryWindow(lastbox, QW_PARENT)) > 0x80000001 && box > 0)
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
189 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
190 lastbox = box;
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
191 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
192 if(box > 0)
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
193 return lastbox;
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
194 return handle;
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
195 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
196
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
197 /* This function changes the owner of buttons in to the
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
198 * dynamicwindows handle to fix a problem in notebooks.
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
199 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
200 void _fix_button_owner(HWND handle, HWND dw)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
201 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
202 HENUM henum;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
203 HWND child;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
204
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
205 henum = WinBeginEnumWindows(handle);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
206 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
207 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
208 char tmpbuf[100];
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
209
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
210 WinQueryClassName(child, 99, tmpbuf);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
211
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
212 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
213 WinSetOwner(child, dw);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
214 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
215 dw = child;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
216
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
217 _fix_button_owner(child, dw);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
218 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
219 WinEndEnumWindows(henum);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
220 return;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
221 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
222
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
223 void _disconnect_windows(HWND handle)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
224 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
225 HENUM henum;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
226 HWND child;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
227
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
228 #ifndef NO_SIGNALS
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
229 dw_signal_disconnect_by_window(handle);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
230 #endif
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
231
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
232 henum = WinBeginEnumWindows(handle);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
233 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
234 _disconnect_windows(child);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
235
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
236 WinEndEnumWindows(henum);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
237 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
238
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
239 /* This function removes and handlers on windows and frees
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
240 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
241 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
242 void _free_window_memory(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
243 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
244 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
245 HWND child;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
246 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
247
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
248 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
249 dw_signal_disconnect_by_window(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
250 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
251
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
252 if(ptr)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
253 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
254 dw_window_set_data(handle, NULL, NULL);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
255 WinSetWindowPtr(handle, QWP_USER, 0);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
256 free(ptr);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
257 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
258
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
259 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
260 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
261 _free_window_memory(child);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
262
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
263 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
264 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
265 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
266
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
267 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
268 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
269 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
270 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
271 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
272 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
273
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
274 if(!handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
275 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
276
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
277 if(!WinIsWindowEnabled(handle))
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
278 return 0;
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
279
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
280 WinQueryClassName(handle, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
281
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
282 /* These are the window classes which can
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
283 * obtain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
284 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
285 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
286 strncmp(tmpbuf, "#3", 3)==0 || /* Button */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
287 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
288 strncmp(tmpbuf, "#7", 3)==0 || /* List box */
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
289 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
290 strncmp(tmpbuf, "#32", 4)==0 || /* Spinbutton */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
291 strncmp(tmpbuf, "#37", 4)==0 || /* Container */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
292 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
293 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
294 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
295 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
296
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
297 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
298 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
299 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
300 static HWND lasthwnd, firsthwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
301 static int finish_searching;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
302
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
303 /* Start is 2 when we have cycled completely and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
304 * need to set the focus to the last widget we found
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
305 * that was valid.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
306 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
307 if(start == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
308 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
309 if(lasthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
310 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
311 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
312 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
313
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
314 /* Start is 1 when we are entering the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
315 * for the first time, it is zero when entering
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
316 * the function recursively.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
317 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
318 if(start == 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
319 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
320 lasthwnd = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
321 finish_searching = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
322 firsthwnd = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
323 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
324
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
325 /* Vertical boxes are inverted on OS/2 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
326 if(box->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
327 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
328 for(z=0;z<box->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
329 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
330 if(box->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
331 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
332 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
333
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
334 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
335 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
336 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
337 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
338 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
339 if(box->items[z].hwnd == handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
340 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
341 if(lasthwnd == handle && firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
342 WinSetFocus(HWND_DESKTOP, firsthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
343 else if(lasthwnd == handle && !firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
344 finish_searching = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
345 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
346 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
347
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
348 /* If we aren't looking for the last handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
349 * return immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
350 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
351 if(!finish_searching)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
352 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
353 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
354 if(_validate_focus(box->items[z].hwnd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
355 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
356 /* Start is 3 when we are looking for the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
357 * first valid item in the layout.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
358 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
359 if(start == 3)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
360 {
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
361 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
362 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
363 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
364 return 1;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
365 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
366 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
367
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
368 if(!firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
369 firsthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
370
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
371 lasthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
372 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
373 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
374 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
375 char tmpbuf[100] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
376
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
377 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
378 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
379 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
380 Box *notebox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
381 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
382 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
383
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
384 if(page)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
385 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
386 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
387
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
388 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
389 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
390 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
391 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
392 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
393 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
394 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
395 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
396 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
397 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
398 for(z=box->count-1;z>-1;z--)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
399 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
400 if(box->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
401 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
402 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
403
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
404 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
405 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
406 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
407 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
408 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
409 if(box->items[z].hwnd == handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
410 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
411 if(lasthwnd == handle && firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
412 WinSetFocus(HWND_DESKTOP, firsthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
413 else if(lasthwnd == handle && !firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
414 finish_searching = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
415 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
416 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
417
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
418 /* If we aren't looking for the last handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
419 * return immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
420 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
421 if(!finish_searching)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
422 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
423 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
424 if(_validate_focus(box->items[z].hwnd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
425 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
426 /* Start is 3 when we are looking for the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
427 * first valid item in the layout.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
428 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
429 if(start == 3)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
430 {
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
431 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
432 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
433 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
434 return 1;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
435 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
436 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
437
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
438 if(!firsthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
439 firsthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
440
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
441 lasthwnd = box->items[z].hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
442 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
443 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
444 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
445 char tmpbuf[100] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
446
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
447 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
448 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
449 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
450 Box *notebox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
451 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
452 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
453
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
454 if(page)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
455 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
456 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
457
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
458 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
459 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
460 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
461 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
462 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
463 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
464 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
465 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
466 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
467 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
468
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
469 int _focus_check_box_back(Box *box, HWND handle, int start, HWND defaultitem)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
470 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
471 int z;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
472 static HWND lasthwnd, firsthwnd;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
473 static int finish_searching;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
474
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
475 /* Start is 2 when we have cycled completely and
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
476 * need to set the focus to the last widget we found
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
477 * that was valid.
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
478 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
479 if(start == 2)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
480 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
481 if(lasthwnd)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
482 WinSetFocus(HWND_DESKTOP, lasthwnd);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
483 return 0;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
484 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
485
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
486 /* Start is 1 when we are entering the function
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
487 * for the first time, it is zero when entering
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
488 * the function recursively.
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
489 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
490 if(start == 1)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
491 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
492 lasthwnd = handle;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
493 finish_searching = 0;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
494 firsthwnd = 0;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
495 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
496
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
497 /* Vertical boxes are inverted on OS/2 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
498 if(box->type == BOXVERT)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
499 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
500 for(z=box->count-1;z>-1;z--)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
501 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
502 if(box->items[z].type == TYPEBOX)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
503 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
504 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
505
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
506 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
507 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
508 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
509 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
510 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
511 if(box->items[z].hwnd == handle)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
512 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
513 if(lasthwnd == handle && firsthwnd)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
514 WinSetFocus(HWND_DESKTOP, firsthwnd);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
515 else if(lasthwnd == handle && !firsthwnd)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
516 finish_searching = 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
517 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
518 WinSetFocus(HWND_DESKTOP, lasthwnd);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
519
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
520 /* If we aren't looking for the last handle,
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
521 * return immediately.
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
522 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
523 if(!finish_searching)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
524 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
525 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
526 if(_validate_focus(box->items[z].hwnd))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
527 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
528 /* Start is 3 when we are looking for the
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
529 * first valid item in the layout.
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
530 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
531 if(start == 3)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
532 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
533 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
534 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
535 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
536 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
537 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
538 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
539
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
540 if(!firsthwnd)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
541 firsthwnd = box->items[z].hwnd;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
542
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
543 lasthwnd = box->items[z].hwnd;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
544 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
545 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
546 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
547 char tmpbuf[100] = "";
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
548
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
549 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
550 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
551 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
552 Box *notebox;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
553 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
554 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
555
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
556 if(page)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
557 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
558 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
559
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
560 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
561 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
562 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
563 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
564 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
565 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
566 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
567 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
568 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
569 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
570 for(z=0;z<box->count;z++)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
571 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
572 if(box->items[z].type == TYPEBOX)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
573 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
574 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
575
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
576 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
577 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
578 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
579 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
580 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
581 if(box->items[z].hwnd == handle)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
582 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
583 if(lasthwnd == handle && firsthwnd)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
584 WinSetFocus(HWND_DESKTOP, firsthwnd);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
585 else if(lasthwnd == handle && !firsthwnd)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
586 finish_searching = 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
587 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
588 WinSetFocus(HWND_DESKTOP, lasthwnd);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
589
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
590 /* If we aren't looking for the last handle,
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
591 * return immediately.
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
592 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
593 if(!finish_searching)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
594 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
595 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
596 if(_validate_focus(box->items[z].hwnd))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
597 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
598 /* Start is 3 when we are looking for the
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
599 * first valid item in the layout.
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
600 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
601 if(start == 3)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
602 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
603 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
604 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
605 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
606 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
607 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
608 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
609
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
610 if(!firsthwnd)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
611 firsthwnd = box->items[z].hwnd;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
612
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
613 lasthwnd = box->items[z].hwnd;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
614 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
615 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
616 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
617 char tmpbuf[100] = "";
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
618
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
619 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
620 if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
621 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
622 Box *notebox;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
623 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
624 (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
625
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
626 if(page)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
627 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
628 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
629
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
630 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem))
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
631 return 1;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
632 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
633 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
634 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
635 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
636 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
637 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
638 return 0;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
639 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
640
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
641 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
642 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
643 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
644 int _initial_focus(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
645 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
646 Box *thisbox = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
647 HWND box;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
648
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
649 box = WinWindowFromID(handle, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
650 if(box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
651 thisbox = WinQueryWindowPtr(box, QWP_USER);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
652 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
653 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
654
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
655 if(thisbox)
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
656 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
657 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
658 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
659
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
660 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
661 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
662 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
663 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
664 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
665 Box *thisbox;
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
666 HWND box, lastbox = _toplevel_window(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
667
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
668 box = WinWindowFromID(lastbox, FID_CLIENT);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
669 if(box)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
670 thisbox = WinQueryWindowPtr(box, QWP_USER);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
671 else
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
672 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
673
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
674 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
675 {
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
676 if(_focus_check_box(thisbox, handle, 1, 0) == 0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
677 _focus_check_box(thisbox, handle, 2, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
678 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
679 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
680
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
681 /* This function finds the current widget in the
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
682 * layout and moves the current focus to the next item.
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
683 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
684 void _shift_focus_back(HWND handle)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
685 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
686 Box *thisbox;
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
687 HWND box, lastbox = _toplevel_window(handle);
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
688
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
689 box = WinWindowFromID(lastbox, FID_CLIENT);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
690 if(box)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
691 thisbox = WinQueryWindowPtr(box, QWP_USER);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
692 else
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
693 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
694
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
695 if(thisbox)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
696 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
697 if(_focus_check_box_back(thisbox, handle, 1, 0) == 0)
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
698 _focus_check_box_back(thisbox, handle, 2, 0);
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
699 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
700 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
701
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
702 /* ResetWindow:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
703 * Resizes window to the exact same size to trigger
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
704 * recalculation of frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
705 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
706 void _ResetWindow(HWND hwndFrame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
707 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
708 SWP swp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
709
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
710 WinQueryWindowPos(hwndFrame, &swp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
711 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy-1, SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
712 WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, swp.cx, swp.cy, SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
713 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
714
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
715 /* This function will recursively search a box and add up the total height of it */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
716 void _count_size(HWND box, int type, int *xsize, int *xorigsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
717 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
718 int size = 0, origsize = 0, z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
719 Box *tmp = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
720
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
721 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
722 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
723 *xsize = *xorigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
724 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
725 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
726
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
727 if(type == tmp->type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
728 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
729 /* If the box is going in the direction we want, then we
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
730 * return the entire sum of the items.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
731 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
732 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
733 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
734 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
735 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
736 int s, os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
737
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
738 _count_size(tmp->items[z].hwnd, type, &s, &os);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
739 size += s;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
740 origsize += os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
741 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
742 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
743 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
744 size += (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
745 origsize += (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
746 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
747 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
748 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
749 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
750 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
751 /* If the box is not going in the direction we want, then we only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
752 * want to return the maximum value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
753 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
754 int tmpsize = 0, tmporigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
755
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
756 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
757 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
758 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
759 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
760 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
761 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
762 tmpsize = (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
763 tmporigsize = (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
764 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
765
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
766 if(tmpsize > size)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
767 size = tmpsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
768 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
769 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
770
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
771 *xsize = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
772 *xorigsize = origsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
773 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
774
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
775
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
776 /* Function: TrackRectangle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
777 * Abstract: Tracks given rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
778 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
779 * If rclBounds is NULL, then track rectangle on entire desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
780 * rclTrack is in window coorditates and will be mapped to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
781 * desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
782 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
783
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
784 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
785 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
786 TRACKINFO track;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
787 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
788
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
789 track.cxBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
790 track.cyBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
791 track.cxGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
792 track.cyGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
793 track.cxKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
794 track.cyKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
795
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
796 if(!rclTrack)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
797 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
798
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
799 if(rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
800 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
801 track.rclBoundary = *rclBounds;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
802 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
803 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
804 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
805 track.rclBoundary.yTop =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
806 track.rclBoundary.xRight = 3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
807 track.rclBoundary.yBottom =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
808 track.rclBoundary.xLeft = -3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
809 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
810
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
811 track.rclTrack = *rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
813 WinMapWindowPoints(hwndBase,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
814 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
815 (PPOINTL)&track.rclTrack,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
816 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
817
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
818 track.ptlMinTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
819 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
820 track.ptlMinTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
821 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
822 track.ptlMaxTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
823 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
824 track.ptlMaxTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
825 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
826
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
827 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
828
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
829 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
830
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
831 if(rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
832 *rclTrack = track.rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
833
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
834 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
835 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
836
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
837 void _check_resize_notebook(HWND hwnd)
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
838 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
839 char tmpbuf[100];
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
840
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
841 WinQueryClassName(hwnd, 99, tmpbuf);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
842
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
843 /* If we have a notebook we resize the page again. */
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
844 if(strncmp(tmpbuf, "#40", 4)==0)
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
845 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
846 unsigned long x, y, width, height;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
847 ULONG page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, 0, MPFROM2SHORT(BKA_FIRST, BKA_MAJOR));
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
848
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
849 while(page)
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
850 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
851 HWND pagehwnd = (HWND)WinSendMsg(hwnd, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(page), 0);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
852 RECTL rc;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
853
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
854 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
855 if(pagebox)
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
856 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
857 dw_window_get_pos_size(hwnd, &x, &y, &width, &height);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
858
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
859 rc.xLeft = x;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
860 rc.yBottom = y;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
861 rc.xRight = x + width;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
862 rc.yTop = y + height;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
863
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
864 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
865
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
866 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
867 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
868 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR));
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
869 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
870
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
871 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
872 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
873
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
874 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
875 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
876 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
877 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
878 int pass, int *usedpadx, int *usedpady)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
879 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
880 int z, currentx = 0, currenty = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
881 int uymax = 0, uxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
882 int upymax = 0, upxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
883 /* Used for the SIZEEXPAND */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
884 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
885 int nupx = *usedpadx, nupy = *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
886
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
887 (*usedx) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
888 (*usedy) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
889
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
890 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
891 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
892 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
893 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
894 int initialx, initialy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
895 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
896
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
897 initialx = x - (*usedx);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
898 initialy = y - (*usedy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
899
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
900 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
901 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
902 int newx, newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
903 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
904 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
905
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
906 /* On the second pass we know how big the box needs to be and how
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
907 * much space we have, so we can calculate a ratio for the new box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
908 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
909 if(pass == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
910 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
911 int deep = *depth + 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
912
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
913 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
914
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
915 tmp->upx = upx - *usedpadx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
916 tmp->upy = upy - *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
917
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
918 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
919 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
920
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
921 tmp->width = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
922 tmp->height = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
923
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
924 tmp->parentxratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
925 tmp->parentyratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
926
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
927 tmp->parentpad = tmp->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
928
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
929 /* Just in case */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
930 tmp->xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
931 tmp->yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
932
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
933 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
934 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
935 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
936 fprintf(f, "FARK! depth %d\r\nwidth = %d, height = %d, nux = %d, nuy = %d, upx = %d, upy = %d xratio = %f, yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
937 *depth, thisbox->items[z].width, thisbox->items[z].height, nux, nuy, tmp->upx, tmp->upy, tmp->xratio, tmp->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
938 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
939 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
940 #endif
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
941
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
942 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
943 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
944 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
945 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
946 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
947 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
948 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
949 if((thisbox->items[z].width-tmp->upx)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
950 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
951 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
952 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
953 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
954 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
955 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
956 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
957 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
958 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
959 if((thisbox->items[z].height-tmp->upy)!=0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
960 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
961 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
962
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
963 nux = *usedx; nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
964 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
965 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
966
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
967 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
968
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
969 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
970 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
971 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
972 fprintf(f, "Before Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
973 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
974 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
975 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
976 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
977
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
978 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
979
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
980 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
981
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
982 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
983 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
984
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
985 tmp->minwidth = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
986 tmp->minheight = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
987
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
988 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
989 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
990 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
991 fprintf(f, "After Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d width = %d, height = %d\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
992 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, thisbox->items[z].width, thisbox->items[z].height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
993 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
994 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
995 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
996 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
997 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
998
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
999 if(pass > 1 && *depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1000 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1001 if(thisbox->type == BOXVERT)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1002 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1003 if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1004 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1005 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1006 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1007 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1008 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1009 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1010 if(thisbox->minwidth-thisbox->upx == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1011 thisbox->items[z].xratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1012 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1013 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1014 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1016 if(thisbox->type == BOXHORZ)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1017 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1018 if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1019 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1020 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1021 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1022 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1023 else
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1024 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1025 if(thisbox->minheight-thisbox->upy == 0)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1026 thisbox->items[z].yratio = 1.0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1027 else
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1028 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy));
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
1029 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1030
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1031 if(thisbox->items[z].type == TYPEBOX)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1032 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1033 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1034
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1035 if(tmp)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1036 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1037 tmp->parentxratio = thisbox->items[z].xratio;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1038 tmp->parentyratio = thisbox->items[z].yratio;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1039 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1040 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1041
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1042 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1043 fprintf(f, "RATIO- xratio = %f, yratio = %f, width = %d, height = %d, pad = %d, box xratio = %f, box yratio = %f, parent xratio = %f, parent yratio = %f, minwidth = %d, minheight = %d, width = %d, height = %d, upx = %d, upy = %d\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1044 thisbox->items[z].xratio, thisbox->items[z].yratio, thisbox->items[z].width, thisbox->items[z].height, thisbox->items[z].pad, thisbox->xratio, thisbox->yratio, thisbox->parentxratio, thisbox->parentyratio, thisbox->minwidth, thisbox->minheight, thisbox->width, thisbox->height, thisbox->upx, thisbox->upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1045 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1046 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1047 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1048 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1049 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1050 thisbox->items[z].xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1051 thisbox->items[z].yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1052 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1053
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1054 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1055 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1056 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1057 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1058 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1059 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1060 if(((thisbox->items[z].pad*2) + thisbox->items[z].width) > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1061 upxmax = (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1062 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1063 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1064 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1065 if(thisbox->items[z].pad*2 > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1066 upxmax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1067 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1068 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1069 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1070 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1071 if(thisbox->items[z].width == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1072 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1073 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1074 /* thisbox->items[z].width = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1075 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1076 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1077 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1078 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1079 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1080 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1081 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1082 (*usedpadx) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1083 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1084 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1085 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1086 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1087 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1088 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1089 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1090 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1091 if(((thisbox->items[z].pad*2) + thisbox->items[z].height) > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1092 upymax = (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1093 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1094 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1095 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1096 if(thisbox->items[z].pad*2 > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1097 upymax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1098 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1099 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1100 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1101 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1102 if(thisbox->items[z].height == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1103 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1104 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1105 /* thisbox->items[z].height = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1106 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1107 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1108 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1109 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1110 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1111 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1112 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1113 (*usedpady) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1114 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1115 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1116 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1117
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1118 (*usedx) += uxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1119 (*usedy) += uymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1120 (*usedpadx) += upxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1121 (*usedpady) += upymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1122
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1123 currentx += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1124 currenty += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1125
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1126 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1127 fprintf(f, "Done Calc depth %d\r\nusedx = %d, usedy = %d, usedpadx = %d, usedpady = %d, currentx = %d, currenty = %d, uxmax = %d, uymax = %d\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1128 *depth, *usedx, *usedy, *usedpadx, *usedpady, currentx, currenty, uxmax, uymax);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1129 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1130 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1131
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1132 /* The second pass is for expansion and actual placement. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1133 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1134 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1135 /* Any SIZEEXPAND items should be set to uxmax/uymax */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1136 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1137 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1138 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1139 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1140 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1141 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1142 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1143 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1144 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1145 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1146
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1147 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1148 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1149 if(*depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1150 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1151 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1152 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1153 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1154 tmp->width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1155 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1156 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1157 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1158 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2))));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1159 tmp->height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1160 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1161 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1162
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1163 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1164
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1165 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1166 fprintf(f, "2- Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f,\r\nupx = %d, upy = %d, width = %d, height = %d, minwidth = %d, minheight = %d, box xratio = %f, box yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1167 *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio, tmp->upx, tmp->upy, thisbox->items[z].width, thisbox->items[z].height, tmp->minwidth, tmp->minheight, thisbox->xratio, thisbox->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1168 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1169 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1170
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1171 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1172
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1173 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1174
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1175 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1176 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1177 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1178
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1179 for(z=0;z<(thisbox->count);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1180 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1181 int height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1182 int width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1183 int pad = thisbox->items[z].pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1184 HWND handle = thisbox->items[z].hwnd;
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
1185 int vectorx, vectory;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1186
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1187 /* When upxmax != pad*2 then ratios are incorrect. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1188 vectorx = (int)((width*thisbox->items[z].xratio)-width);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1189 vectory = (int)((height*thisbox->items[z].yratio)-height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1190
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1191 if(width > 0 && height > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1192 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1193 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1194 /* This is a hack to fix rounding of the sizing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1195 if(*depth == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1196 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1197 vectorx++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1198 vectory++;
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 /* If this item isn't going to expand... reset the vectors to 0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1202 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1203 vectory = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1204 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1205 vectorx = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1206
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1207 WinQueryClassName(handle, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1208
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1209 if(strncmp(tmpbuf, "#2", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1210 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1211 /* Make the combobox big enough to drop down. :) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1212 WinSetWindowPos(handle, HWND_TOP, currentx + pad, (currenty + pad) - 100,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1213 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1214 }
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1215 else if(strncmp(tmpbuf, "#6", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1216 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1217 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1218 WinSetWindowPos(handle, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1219 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1220 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1221 else if(strncmp(tmpbuf, "#40", 5)==0)
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1222 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1223 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1224 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1225 _check_resize_notebook(handle);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1226 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1227 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1228 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1229 WinSetWindowPos(handle, HWND_TOP, currentx + pad, currenty + pad,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1230 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1231 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1232 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1233 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1234
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1235 if(boxinfo && boxinfo->grouphwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1236 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0,
47
997e9ed670ef Fixes for box alignment problem on OS/2, crash in dw_bitmap_new() on unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 40
diff changeset
1237 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1238
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1239 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1240
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1241 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1242
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1243 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1244 fprintf(f, "Window Pos depth %d\r\ncurrentx = %d, currenty = %d, pad = %d, width = %d, height = %d, vectorx = %d, vectory = %d, Box type = %s\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1245 *depth, currentx, currenty, pad, width, height, vectorx, vectory,thisbox->type == BOXHORZ ? "Horizontal" : "Vertical");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1246 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1247 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1248
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1249 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1250 currentx += width + vectorx + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1251 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1252 currenty += height + vectory + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1253 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1254 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1255 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1256 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1257 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1258
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1259 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1260 {
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1261 if(x != 0 && y != 0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
1262 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1263 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1264 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1265 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1266
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1267 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1268
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1269 if(usedx-usedpadx == 0 || usedy-usedpady == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1270 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1271
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1272 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1273 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1274
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1275 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1276 fprintf(f, "WM_SIZE Resize Box Pass 1\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1277 x, y, usedx, usedy, usedpadx, usedpady, thisbox->xratio, thisbox->yratio);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1278 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1279 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1280
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1281 usedx = usedy = usedpadx = usedpady = depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1282
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1283 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1284 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1285 fprintf(f, "WM_SIZE Resize Box Pass 2\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d\r\n",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1286 x, y, usedx, usedy, usedpadx, usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1287 reopen();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1288 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1289 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1290 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1291 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1292
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1293 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1294 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1295 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1296 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1297 Box *thisbox = NULL;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1298 HWND box;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1299
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1300 box = WinWindowFromID(hWnd, FID_CLIENT);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1301 if(box)
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1302 thisbox = WinQueryWindowPtr(box, QWP_USER);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1303
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1304 if(thisbox && !thisbox->titlebar)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1305 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1306 switch(msg)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1307 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1308 case WM_QUERYTRACKINFO:
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1309 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1310 if(blah && *blah)
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1311 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1312 PTRACKINFO ptInfo;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1313 int res;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1314 PFNWP myfunc = *blah;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1315 res = (int)myfunc(hWnd, msg, mp1, mp2);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1316
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1317 ptInfo = (PTRACKINFO)(mp2);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1318
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1319 ptInfo->ptlMinTrackSize.y = 8;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1320 ptInfo->ptlMinTrackSize.x = 8;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1321
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1322 return (MRESULT)res;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1323 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1324 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1325 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1326 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1327
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1328 if(blah && *blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1329 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1330 PFNWP myfunc = *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1331 return myfunc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1332 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1333
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1334 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1335 }
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1336
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1337 void _Top(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1338 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1339 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1340
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1341 ptl1.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1342 ptl2.y = ptl1.y = rclPaint.yTop - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1343 ptl2.x = rclPaint.xRight - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1344 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1345 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1346 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1347
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1348 /* Left hits the bottom */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1349 void _Left(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1350 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1351 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1352
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1353 ptl2.x = ptl1.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1354 ptl1.y = rclPaint.yTop - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1355 ptl2.y = rclPaint.yBottom;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1356 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1357 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1358 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1359
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1360 void _Bottom(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1361 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1362 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1363
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1364 ptl1.x = rclPaint.xRight - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1365 ptl1.y = ptl2.y = rclPaint.yBottom;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1366 ptl2.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1367 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1368 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1369 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1370
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1371 /* Right hits the top */
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1372 void _Right(HPS hpsPaint, RECTL rclPaint)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1373 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1374 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1375
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1376 ptl2.x = ptl1.x = rclPaint.xRight - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1377 ptl1.y = rclPaint.yBottom + 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1378 ptl2.y = rclPaint.yTop - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1379 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1380 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1381 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1382
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1383 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1384 MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1385 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1386 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1387
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1388 if(blah && *blah)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1389 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1390 PFNWP myfunc = *blah;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1391
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1392 switch(msg)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1393 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1394 case WM_PAINT:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1395 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1396 HPS hpsPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1397 RECTL rclPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1398 char buf[1024];
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1399
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1400 hpsPaint = WinBeginPaint(hWnd, 0, 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1401 WinQueryWindowRect(hWnd, &rclPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1402 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1403
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1404 GpiSetColor(hpsPaint, CLR_DARKGRAY);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1405 _Top(hpsPaint, rclPaint);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1406 _Left(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1407
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1408 GpiSetColor(hpsPaint, CLR_WHITE);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1409 _Right(hpsPaint, rclPaint);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1410 _Bottom(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1411
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1412 WinQueryWindowText(hWnd, 1024, buf);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1413 rclPaint.xLeft += 3;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1414 rclPaint.xRight--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1415 rclPaint.yTop--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1416 rclPaint.yBottom++;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1417
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1418 GpiSetColor(hpsPaint, CLR_BLACK);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1419 WinDrawText(hpsPaint, -1, buf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1420 WinEndPaint(hpsPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1421
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1422 return (MRESULT)TRUE;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1423 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1424 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1425 return myfunc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1426 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1427
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1428 return WinDefWindowProc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1429 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1430
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1431 void _click_default(HWND handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1432 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1433 char tmpbuf[100];
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1434
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1435 WinQueryClassName(handle, 99, tmpbuf);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1436
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1437 /* These are the window classes which can
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1438 * obtain input focus.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1439 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1440 if(strncmp(tmpbuf, "#3", 3)==0)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1441 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1442 /* Generate click on default item */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1443 SignalHandler *tmp = Root;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1444
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1445 /* Find any callbacks for this function */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1446 while(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1447 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1448 if(tmp->message == WM_COMMAND)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1449 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1450 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1451
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1452 /* Make sure it's the right window, and the right ID */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1453 if(tmp->window == handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1454 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1455 clickfunc(tmp->window, tmp->data);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1456 tmp = NULL;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1457 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1458 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1459 if(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1460 tmp= tmp->next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1461 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1462 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1463 else
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1464 WinSetFocus(HWND_DESKTOP, handle);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1465 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1466
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1467 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1468 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1469 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1470
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1471 switch(msg)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1472 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1473 case WM_SETFOCUS:
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1474 _run_event(hWnd, msg, mp1, mp2);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1475 break;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1476 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1477
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1478 if(blah && blah->oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1479 return blah->oldproc(hWnd, msg, mp1, mp2);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1480
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1481 return WinDefWindowProc(hWnd, msg, mp1, mp2);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1482 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1483
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1484 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1485 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1486 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1487 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1488 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1489 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
1490 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
1491
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1492 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1493 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1494
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1495 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1496 {
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1497 case WM_BUTTON1DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1498 case WM_BUTTON2DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1499 case WM_BUTTON3DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1500 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1501 char tmpbuf[100];
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1502
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1503 WinQueryClassName(hWnd, 99, tmpbuf);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1504
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1505 if(strncmp(tmpbuf, "#32", 4)==0)
38
538db2a48bac Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 37
diff changeset
1506 _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
1507 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1508 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
1509 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
1510 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1511 char tmpbuf[100];
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1512
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1513 WinQueryClassName(hWnd, 99, tmpbuf);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1514
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1515 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
1516 _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
1517 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1518 break;
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1519 case WM_SETFOCUS:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1520 _run_event(hWnd, msg, mp1, mp2);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1521 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1522 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1523 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1524 {
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
1525 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
1526 _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
1527 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
1528 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1529 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1530 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1531 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
1532 _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
1533 /* 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
1534 * 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
1535 */
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1536 else if(SHORT1FROMMP(mp2) == 283)
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1537 return TRUE;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1538
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1539 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1540 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
1541 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1542 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
1543
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1544 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
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
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1565 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
1566 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1567 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
1568 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
1569 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
1570 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
1571 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
1572 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
1573 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1574
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1575 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
1576 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1577 int inew, range = dw_percent_query_range(hwnd);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1578 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
1579 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
1580 float fnew = (fpos/frange)*1000.0;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1581 inew = (int)fnew;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1582 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew);
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1583 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1584
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1585 /* 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
1586 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
1587 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1588 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
1589 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
1590
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1591 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
1592 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
1593
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1594 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
1595 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1596 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
1597 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
1598 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1599 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
1600 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1601 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1602 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1603
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1604 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1605 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1606
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1607 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1608 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1609
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1610 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1611 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1612 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1613 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1614 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1615 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
1616 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
1617
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1618 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1619 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1620
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1621 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1622 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1623 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1624 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1625 {
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
1626 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
1627 _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
1628 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
1629 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1630 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1631 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1632 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
1633 _click_default(blah->clickdefault);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1634 break;
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1635 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
1636 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
1637 case WM_BUTTON3DOWN:
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1638 _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
1639 break;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1640 case WM_SETFOCUS:
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1641 _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
1642 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1643 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1644 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1645 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1646 ULONG bcol, av[32];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1647 HPS hpsPaint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1648 POINTL ptl; /* Add 6 because it has a thick border like the entryfield */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1649 unsigned long width, height, thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW) + 6;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1650
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1651 WinQueryPresParam(parent, PP_BACKGROUNDCOLORINDEX, 0, &bcol, sizeof(ULONG), &av, QPF_ID1COLORINDEX | QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1652 dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1653
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1654 hpsPaint = WinGetPS(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1655 GpiSetColor(hpsPaint, CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1656
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1657 ptl.x = 0;
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1658 ptl.y = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1659 GpiMove(hpsPaint, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1660
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1661 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1662 ptl.y = height - thumbheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1663 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1664
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1665 WinReleasePS(hpsPaint);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1666 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1667 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1668 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1669 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1670 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1671
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1672 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1673 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1674
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1675 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1676 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1677 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1678 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1679 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1680
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1681 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1682 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1683 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1684 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1685 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1686 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1687 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1688
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1689 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1690 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1691 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1692 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1693 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1694
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1695 /* Returns height of specified window. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1696 int _get_height(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1697 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1698 unsigned long height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1699 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1700 return (int)height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1701 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1702
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1703 /* Find the height of the frame a desktop style window is sitting on */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1704 int _get_frame_height(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1705 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1706 while(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1707 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1708 HWND client;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1709 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1710 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1711 return _get_height(WinQueryWindow(handle, QW_PARENT));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1712 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1713 handle = WinQueryWindow(handle, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1714 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1715 return dw_screen_height();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1716 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1717
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1718 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1719 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1720 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1721 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1722 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1723 ULONG origmsg = msg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1724
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1725 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1726 msg = WM_BUTTON1DOWN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1727 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1728 msg = WM_BUTTON1UP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1729
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1730 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1731 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1732 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1733 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1734 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1735 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1736 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1737 case WM_SETFOCUS:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1738 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1739 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
1740 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1741 int (*setfocusfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1742
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1743 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
1744 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1745 result = setfocusfunc(tmp->window, tmp->data);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1746 tmp = NULL;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1747 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1748 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1749 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
1750 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1751 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1752 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1753 int (*sizefunc)(HWND, int, int, void *) = (int (*)(HWND, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1754
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1755 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1756 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1757 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1758 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1759 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1760 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1761 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1762 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1763 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1764 POINTS pts = (*((POINTS*)&mp1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1765 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1766
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1767 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1768 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1769 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1770
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1771 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1772 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1773 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1774 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1775 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1776 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1777 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1778 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1779 case WM_BUTTON3DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1780 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1781 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1782 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1783
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1784 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
1785 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1786 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1787 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1788 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1789 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1790 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1791 POINTS pts = (*((POINTS*)&mp1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1792 int (*buttonfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1793
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1794 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1795 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
1796 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1797
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1798 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1799 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1800 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1801 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1802 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1803 case WM_BUTTON2UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1804 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1805 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1806 case WM_BUTTON3UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1807 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1808 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1809 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1810
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1811 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
1812 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1813 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1814 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1815 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1816 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1817 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1818 int (*motionfunc)(HWND, int, int, int, void *) = (int (*)(HWND, int, int, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1819
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1820 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1821 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1822 int keys = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1823 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1824
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1825 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1826 keys = DW_BUTTON1_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1827 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1828 keys |= DW_BUTTON2_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1829 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1830 keys |= DW_BUTTON3_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1831
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1832 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1833 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1834 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1835 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1836 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1837 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1838 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1839 int (*keypressfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1840
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1841 if(hWnd == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1842 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1843 result = keypressfunc(tmp->window, SHORT1FROMMP(mp2), tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1844 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1845 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1846 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1847 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1848 case WM_CLOSE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1849 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1850 int (*closefunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1851
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1852 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1853 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1854 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
1855 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
1856 result = FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1857 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1858 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1859 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1860 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1861 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1862 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1863 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1864 DWExpose exp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1865 int (*exposefunc)(HWND, DWExpose *, void *) = (int (*)(HWND, DWExpose *, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1866 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1867
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1868 if(hWnd == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1869 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1870 int height = _get_height(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1871
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1872 hps = WinBeginPaint(hWnd, 0L, &rc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1873 exp.x = rc.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1874 exp.y = height - rc.yTop - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1875 exp.width = rc.xRight - rc. xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1876 exp.height = rc.yTop - rc.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1877 result = exposefunc(hWnd, &exp, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1878 WinEndPaint(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1879 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1880 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1881 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1882 case WM_COMMAND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1883 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1884 int (*clickfunc)(HWND, void *) = (int (*)(HWND, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1885 ULONG command = COMMANDMSG(&msg)->cmd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1886
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1887 if(tmp->window < 65536 && command == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1888 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
1889 result = clickfunc(popup ? popup : tmp->window, tmp->data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1890 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1891 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1892 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1893 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1894 case WM_CONTROL:
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1895 if(tmp->message == SHORT2FROMMP(mp1) || (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1896 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1897 switch(SHORT2FROMMP(mp1))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1898 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1899 case CN_ENTER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1900 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1901 int (*containerselectfunc)(HWND, char *, void *) = (int (*)(HWND, char *, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1902 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1903 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1904 char *text = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1905
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1906 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1907 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1908 PRECORDCORE pre;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1909
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1910 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1911 if(pre)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1912 text = pre->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1913 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1914
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1915 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1916 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1917 result = containerselectfunc(tmp->window, text, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1918 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1919 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1920 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1921 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1922 case CN_CONTEXTMENU:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1923 {
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
1924 int (*containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (*)(HWND, char *, int, int, void *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1925 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1926 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1927 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
1928 void *user = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1929 LONG x,y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1930
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1931 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1932 {
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1933 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
1934
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1935 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
1936
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1937 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
1938 user = pci->user;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1939 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1940
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1941 dw_pointer_query_pos(&x, &y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1942
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1943 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1944 {
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
1945 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
1946 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1947 NOTIFYRECORDEMPHASIS pre;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1948
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1949 dw_tree_item_select(tmp->window, (HWND)mp2);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1950 pre.pRecord = mp2;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1951 pre.fEmphasisMask = CRA_CURSORED;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1952 pre.hwndCnr = tmp->window;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1953 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1954 pre.pRecord->flRecordAttr |= CRA_CURSORED;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1955 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1956 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1957 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1958 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1959 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1960 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
1961 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
1962 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1963 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
1964 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
1965
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1966 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
1967 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1968 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
1969
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1970 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
1971 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1972 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
1973 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1974 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
1975
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1976 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
1977 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1978 int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (*)(HWND, HWND, char *, void *, void *))tmp->signalfunction;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1979
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1980 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1981 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1982 lasthcnr = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1983 lastitem = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1984 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1985 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1986 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1987 lasthcnr = tmp->window;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1988 lastitem = (HWND)pci;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1989 result = treeselectfunc(tmp->window, (HWND)pci, pci->rc.pszIcon, pci->user, tmp->data);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1990 }
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
1991 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
1992 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1993 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1994 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1995 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
1996 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1997 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
1998 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1999 case LN_SELECT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2000 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2001 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
2002
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2003 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
2004
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2005 if(strncmp(classbuf, "#38", 4) == 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2006 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2007 int (*valuechangedfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2008
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2009 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
2010 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2011 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
2012 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
2013 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
2014 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
2015 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2016 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
2017 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
2018 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
2019 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2020 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
2021 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2022 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2023 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2024 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2025 int (*listboxselectfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2026 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
2027 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
2028 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
2029
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2030 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2031 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2032 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
2033 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
2034
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2035 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
2036
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2037 _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
2038
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2039 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
2040 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2041 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
2042
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2043 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
2044
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2045 /* 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
2046 * 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
2047 */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2048 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
2049 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
2050
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2051 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
2052 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
2053 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2054 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2055 result = listboxselectfunc(tmp->window, index, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2056
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2057 _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
2058 tmp = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2059 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2060 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2061 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2062 break;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2063 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
2064 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2065 int (*valuechangedfunc)(HWND, int, void *) = (int (*)(HWND, int, void *))tmp->signalfunction;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2066
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2067 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
2068 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2069 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
2070 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
2071 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
2072 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
2073 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2074 dw_window_set_data(tmp->window, "_dw_slider_value", (void *)ulValue);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2075 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
2076 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
2077 lasthwnd = tmp->window;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2078 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2079 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2080 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2081 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2082
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2083 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2084 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2085 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2086 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2087 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2088 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2089
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2090 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2091 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2092
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2093 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2094
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2095 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2096 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2097 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2098
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2099 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2100 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2101 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2102 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2103
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2104 #ifndef NO_SIGNALS
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2105 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2106 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2107 case WM_CONTROL:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2108 _run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2109 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2110 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2111 #endif
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2112
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2113 if(blah && blah->oldproc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2114 return blah->oldproc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2115
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2116 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2117 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2118
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2119 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2120 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2121 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2122 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2123 static int command_active = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2124 void (* windowfunc)(PVOID) = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2125
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2126 if(filterfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2127 result = filterfunc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2128
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2129 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2130 if(result == -1 && !command_active)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2131 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2132 /* Make sure we don't end up in infinite recursion */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2133 command_active = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2134
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2135 result = (int)_run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2136
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2137 command_active = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2138 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2139 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2140
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2141 /* Now that any handlers are done... do normal processing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2142 switch( msg )
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2143 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2144 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2145 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2146
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2147 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2148 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2149 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2150 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2151
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2152 hps = WinBeginPaint( hWnd, 0L, &rc );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2153 WinEndPaint( hps );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2154 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2155 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2156
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2157 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2158 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2159 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2160
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2161 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2162 return (MPARAM)TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2163
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2164 if(mybox && mybox->flags != DW_MINIMIZED)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2165 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2166 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2167 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2168 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2169 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2170
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2171 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2172
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2173 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2174 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2175 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2176 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2177 case WM_MINMAXFRAME:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2178 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2179 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2180 SWP *swp = (SWP *)mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2181
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2182 if(mybox && (swp->fl & SWP_MINIMIZE))
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2183 mybox->flags = DW_MINIMIZED;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2184
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2185 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
2186 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2187 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
2188 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2189 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
2190 }
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2191
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2192 if(mybox && (swp->fl & SWP_MAXIMIZE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2193 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2194 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
2195 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
2196
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
2197 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
2198
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
2199 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
2200 return FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2201
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2202 mybox->flags = 0;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2203
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2204 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2205 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2206 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2207 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2208
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2209 _do_resize(mybox, swp->cx, swp->cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2210
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2211 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2212 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2213 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2214
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2215 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
2216 _check_resize_notebook(mybox->items[z].hwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2217
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2218 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2219
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2220 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2221 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2222 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2223 break;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2224 case WM_CONTROL:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2225 switch(SHORT2FROMMP(mp1))
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2226 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2227 case BKN_PAGESELECTEDPENDING:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2228 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2229 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2230 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
2231 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
2232 unsigned long x, y, width, height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2233 RECTL rc;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2234
21
c6e76b796b28 Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 20
diff changeset
2235 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
2236 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2237 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
2238
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2239 rc.xLeft = x;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2240 rc.yBottom = y;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2241 rc.xRight = x + width;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2242 rc.yTop = y + height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2243
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2244 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
2245
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2246 _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
2247 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2248 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2249 break;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2250 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2251 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2252 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
2253 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
2254 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2255 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
2256 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
2257 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2258 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2259 case WM_USER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2260 windowfunc = (void (*)(void *))mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2261
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2262 if(windowfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2263 windowfunc((void *)mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2264 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2265 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2266 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2267 {
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
2268 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
2269 _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
2270 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
2271 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2272 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2273 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2274 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2275 case WM_DESTROY:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2276 /* Free memory before destroying */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2277 _free_window_memory(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2278 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2279 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2280
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2281 if(result != -1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2282 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2283 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2284 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2285 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2286
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2287 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2288 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2289 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2290
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2291 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2292 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2293 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2294 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2295 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2296 _changebox(tmp, percent, type);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2297 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2298 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2299 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2300 if(type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2301 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2302 if(thisbox->items[z].hsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2303 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2304 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2305 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2306 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2307 if(thisbox->items[z].vsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2308 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2309 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2310 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2311 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2312 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2313
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2314 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2315 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2316 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2317 HWND hwndFrame = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2318 Box *thisbox = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2319
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2320 hwndFrame = WinQueryWindow(hwnd, QW_PARENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2321 if(hwndFrame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2322 thisbox = WinQueryWindowPtr(hwndFrame, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2323
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2324 switch (msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2325 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2326 case WM_ACTIVATE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2327 case WM_SETFOCUS:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2328 return (MRESULT)(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2329
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2330 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2331 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2332 HPS hpsPaint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2333 RECTL rclPaint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2334 POINTL ptlStart[SPLITBAR_WIDTH];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2335 POINTL ptlEnd[SPLITBAR_WIDTH];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2336 USHORT i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2337
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2338 hpsPaint = WinBeginPaint(hwnd, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2339 WinQueryWindowRect(hwnd, &rclPaint);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2340
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2341 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2342 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2343 for(i = 0; i < SPLITBAR_WIDTH; i++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2344 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2345 ptlStart[i].x = rclPaint.xLeft + i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2346 ptlStart[i].y = rclPaint.yTop;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2347
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2348 ptlEnd[i].x = rclPaint.xLeft + i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2349 ptlEnd[i].y = rclPaint.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2350 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2351 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2352 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2353 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2354 for(i = 0; i < SPLITBAR_WIDTH; i++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2355 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2356 ptlStart[i].x = rclPaint.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2357 ptlStart[i].y = rclPaint.yBottom + i;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2358
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2359 ptlEnd[i].x = rclPaint.xRight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2360 ptlEnd[i].y = rclPaint.yBottom + i;
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
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2364 for(i = 0; i < SPLITBAR_WIDTH; i++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2365 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2366 GpiSetColor( hpsPaint, lColor[i]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2367 GpiMove(hpsPaint, &ptlStart[i]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2368 GpiLine(hpsPaint, &ptlEnd[i]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2369 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2370 WinEndPaint(hpsPaint);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2371 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2372 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2373
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2374 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2375 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2376 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2377 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2378 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2379 SPTR_SIZEWE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2380 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2381 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2382 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2383 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2384 SPTR_SIZENS,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2385 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2386 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2387 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2388 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2389 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2390 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2391 RECTL rclFrame;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2392 RECTL rclBounds;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2393 RECTL rclStart;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2394 USHORT startSize, orig, actual;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2395
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2396 WinQueryWindowRect(hwnd, &rclFrame);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2397 WinQueryWindowRect(hwnd, &rclStart);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2398
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2399 WinQueryWindowRect(hwndFrame, &rclBounds);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2400
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2401 WinMapWindowPoints(hwndFrame, HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2402 (PPOINTL)&rclBounds, 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2403 WinMapWindowPoints(hwnd, HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2404 (PPOINTL)&rclStart, 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2405
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2406 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2407 int z, pastsplitbar = FALSE, found = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2408 orig = actual = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2409
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2410 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2411 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2412 if(thisbox->items[z].hwnd == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2413 pastsplitbar = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2414 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2415 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2416 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2417 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2418 int tmpwidth, tmporigwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2419
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2420 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2421 _count_size(thisbox->items[z].hwnd, BOXHORZ, &tmpwidth, &tmporigwidth);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2422 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2423 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2424 tmpwidth = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2425 tmporigwidth = thisbox->items[z].origwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2426 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2427
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2428 if(thisbox->items[z].hsize != SIZESTATIC && tmpwidth > actual && tmporigwidth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2429 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2430 found = pastsplitbar;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2431 orig = tmporigwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2432 actual = tmpwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2433 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2434 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2435 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2436 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2437 int tmpheight, tmporigheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2438
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2439 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2440 _count_size(thisbox->items[z].hwnd, BOXVERT, &tmpheight, &tmporigheight);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2441 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2442 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2443 tmpheight = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2444 tmporigheight = thisbox->items[z].origheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2445 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2446
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2447 if(thisbox->items[z].vsize != SIZESTATIC && tmpheight > actual && tmporigheight)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2448 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2449 found = pastsplitbar;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2450 orig = tmporigheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2451 actual = tmpheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2452 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2453 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2454 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2455 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2456
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2457 /* If we couldn't determine a valid scale... then abort */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2458 if(!orig || !actual)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2459 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2460
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2461 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2462 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2463 if(found)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2464 startSize = (rclStart.xLeft - rclBounds.xLeft)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2465 * (((float)actual)/((float)orig));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2466 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2467 startSize = (rclStart.xLeft - rclBounds.xLeft)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2468 * (((float)orig)/((float)actual));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2469 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2470 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2471 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2472 if(found)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2473 startSize = (rclStart.yBottom - rclBounds.yBottom)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2474 * (((float)actual)/((float)orig));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2475 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2476 startSize = (rclStart.yBottom - rclBounds.yBottom)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2477 * (((float)orig)/((float)actual));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2478 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2479 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2480
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2481 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2482
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2483 if(rc == TRUE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2484 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2485 USHORT usNewRB;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2486 USHORT percent;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2487 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2488
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2489 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2490 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2491 usNewRB = rclFrame.xLeft
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2492 - rclBounds.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2493 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2494 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2495 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2496 usNewRB = rclFrame.yBottom
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2497 - rclBounds.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2498 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2499
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2500 /* We don't want the item to disappear completely */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2501 if(!usNewRB)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2502 usNewRB++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2503
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2504 if(!startSize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2505 startSize++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2506
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2507 percent = (usNewRB*100)/startSize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2508
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2509 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2510 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2511 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2512 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2513 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2514
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2515 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
2516 _changebox(tmp, percent, thisbox->type);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2517 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2518 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2519 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2520 if(thisbox->items[z].hwnd == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2521 percent = (startSize*100)/usNewRB;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2522
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2523 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2524 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2525 if(thisbox->items[z].hsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2526 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2527 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2528 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2529 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2530 if(thisbox->items[z].vsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2531 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2532 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2533 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2534 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2535
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2536 _ResetWindow(WinQueryWindow(hwnd, QW_OWNER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2537 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2538 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2539 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2540 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2541 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2542 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2543
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2544 /* Function: BubbleProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2545 * Abstract: Subclass procedure for bubble help
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2546 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2547 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2548 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2549 MRESULT res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2550 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2551
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2552 if(proc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2553 res = proc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2554 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2555 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2556
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2557 if(msg == WM_PAINT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2558 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2559 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2560 HPS hpsTemp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2561 RECTL rcl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2562 int height, width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2563
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2564 WinQueryWindowRect(hwnd, &rcl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2565 height = rcl.yTop - rcl.yBottom - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2566 width = rcl.xRight - rcl.xLeft - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2567
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2568 /* Draw a border around the bubble help */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2569 hpsTemp = WinGetPS(hwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2570 GpiSetColor(hpsTemp, DW_CLR_BLACK);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2571 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2572 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2573 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2574 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2575 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2576 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2577 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2578 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2579 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2580 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2581 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2582 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2583 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2584 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2585 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2586 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2587 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2588 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2589 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2590 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2591 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2592 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2593 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2594 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2595 return res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2596 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2597
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2598 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2599 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2600 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2601
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2602 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2603 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2604 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
2605 PFNWP oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2606
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2607 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2608
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2609 if(!bubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2610 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2611
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
2612 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
2613
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2614 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2615 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2616 #ifndef NO_SIGNALS
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2617 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
2618 if(mp2)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2619 _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
2620 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2621 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2622 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2623 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2624 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2625 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2626
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2627 if(WinIsWindowEnabled(hwnd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2628 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2629 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2630 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2631 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2632 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2633 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2634 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2635 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2636 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2637 /* Due to the fact that if we run the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2638 * here, finishing actions on the button will occur
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2639 * after we run the signal handler. So we post the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2640 * message so the button can finish what it needs to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2641 * do before we run our handler.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2642 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2643 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2644 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2645 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2646 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2647 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2648 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2649 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2650 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2651 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2652 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2653 case WM_USER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2654 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2655 SignalHandler *tmp = (SignalHandler *)mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2656 int (*clickfunc)(HWND, void *) = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2657
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2658 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2659 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2660 clickfunc = (int (*)(HWND, void *))tmp->signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2661
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2662 clickfunc(tmp->window, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2663 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2664 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2665 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2666 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2667 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2668 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2669 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2670 /* A button press should also occur for an ENTER or SPACE press
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2671 * while the button has the active input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2672 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2673 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2674 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2675 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2676
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2677 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2678 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2679 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2680 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2681 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2682 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2683 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2684 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2685 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2686 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2687 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2688 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2689 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2690 tmp= tmp->next;
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 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2694 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2695 {
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
2696 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
2697 _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
2698 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
2699 _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
2700 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
2701 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
2702 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2703 else 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
2704 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2705 _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
2706 return FALSE;
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2707 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
2708 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_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
2709 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2710 _shift_focus(hwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2711 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2712 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2713 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2714 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2715 case 0x041f:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2716 if (hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2717 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2718 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2719 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2720 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2721 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2722
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2723 case 0x041e:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2724
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2725 if(!*bubble->bubbletext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2726 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2727
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2728 if(hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2729 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2730 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2731 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2732 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2733
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2734 if(!hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2735 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2736 HPS hpsTemp = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2737 LONG lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2738 LONG lWidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2739 POINTL txtPointl[TXTBOX_COUNT];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2740 POINTL ptlWork = {0,0};
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2741 ULONG ulColor = DW_CLR_YELLOW;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2742 void *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2743
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2744 hwndBubbleLast = hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2745 hwndBubble = WinCreateWindow(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2746 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2747 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2748 SS_TEXT |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2749 DT_CENTER |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2750 DT_VCENTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2751 0,0,0,0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2752 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2753 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2754 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2755 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2756 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2757
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2758 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2759 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2760 sizeof(DefaultFont),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2761 DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2762
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2763
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2764 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2765 PP_BACKGROUNDCOLORINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2766 sizeof(ulColor),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2767 &ulColor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2768
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2769 WinSetWindowText(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2770 bubble->bubbletext);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2771
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2772 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2773
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2774 hpsTemp = WinGetPS(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2775 GpiQueryTextBox(hpsTemp,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2776 strlen(bubble->bubbletext),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2777 bubble->bubbletext,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2778 TXTBOX_COUNT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2779 txtPointl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2780 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2781
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2782 lWidth = txtPointl[TXTBOX_TOPRIGHT].x -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2783 txtPointl[TXTBOX_TOPLEFT ].x + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2784
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2785 lHight = txtPointl[TXTBOX_TOPLEFT].y -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2786 txtPointl[TXTBOX_BOTTOMLEFT].y + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2787
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2788 ptlWork.y -= lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2789
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2790 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2791
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2792 if(blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2793 WinSetWindowPtr(hwndBubble, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2794
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2795 WinSetWindowPos(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2796 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2797 ptlWork.x,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2798 ptlWork.y,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2799 lWidth,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2800 lHight,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2801 SWP_SIZE | SWP_MOVE | SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2802 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2803 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2804 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2805
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
2806 if(!oldproc)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2807 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
2808 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2809 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2810
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2811 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2812 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2813 int res = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2814 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2815 res = (int)_run_event(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2816 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2817 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2818 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2819 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2820 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2821 case WM_BUTTON3DOWN:
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2822 if(res)
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2823 return (MPARAM)TRUE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2824 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2825 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2826 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2827
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2828 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
2829 {
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
2830 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
2831 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
2832
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2833 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
2834 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
2835
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2836 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
2837 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2838 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
2839 _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
2840 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
2841 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
2842 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
2843 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2844 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
2845 _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
2846 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
2847 _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
2848 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
2849 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2850 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
2851 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2852
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2853 #ifndef NO_SIGNALS
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2854 _run_event(hwnd, msg, mp1, mp2);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2855 #endif
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
2856 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
2857 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
2858
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2859 return WinDefWindowProc(hwnd, msg, mp1, mp2);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2860 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2861
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2862 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2863 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2864 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2865 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2866 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2867 */
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2868 int dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2869 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2870 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2871
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2872 if(newthread)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2873 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2874 dwhab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2875 dwhmq = WinCreateMsgQueue(dwhab, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2876 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2877
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2878 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2879 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2880
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2881 /* Get the OS/2 version. */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2882 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
2883
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2884 #ifdef DWDEBUG
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2885 f = fopen("dw.log", "w");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2886 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2887 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2888 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2889
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2890 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2891 * Runs a message loop for Dynamic Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2892 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2893 * currenthab: The handle to the current anchor block
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2894 * or NULL if this DW is handling the message loop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2895 * func: Function pointer to the message filter function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2896 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2897 void dw_main(HAB currenthab, void *func)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2898 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2899 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2900 HAB habtouse;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2901
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2902 if(!currenthab)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2903 habtouse = dwhab;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2904 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2905 habtouse = currenthab;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2906
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2907 /* Setup the filter function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2908 filterfunc = (int (* EXPENTRY)(HWND, ULONG, MPARAM, MPARAM))func;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2909
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2910 _dwtid = dw_thread_id();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2911
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2912 while (WinGetMsg(habtouse, &qmsg, 0, 0, 0))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2913 WinDispatchMsg(habtouse, &qmsg);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2914
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2915 #ifdef DWDEBUG
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2916 fclose(f);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2917 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2918
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2919 if(!currenthab)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2920 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2921 WinDestroyMsgQueue(dwhmq);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2922 WinTerminate(dwhab);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2923 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2924 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2925
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2926 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2927 * 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
2928 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2929 * 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
2930 */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2931 void dw_main_sleep(int milliseconds)
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2932 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2933 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
2934 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
2935
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2936 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
2937 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2938 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
2939 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2940 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2941 WinDispatchMsg(dwhab, &qmsg);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2942 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2943 else
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2944 DosSleep(1);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2945 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2946 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2947
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
2948 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2949 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2950 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2951 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2952 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2953 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2954 void dw_free(void *ptr)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2955 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2956 free(ptr);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2957 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2958
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2959 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2960 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2961 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2962 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2963 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2964 DWDialog *dw_dialog_new(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2965 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2966 DWDialog *tmp = malloc(sizeof(DWDialog));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2967
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2968 tmp->eve = dw_event_new();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2969 dw_event_reset(tmp->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2970 tmp->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2971 tmp->done = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2972 tmp->result = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2973
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2974 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2975 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2976
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2977 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2978 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2979 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2980 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2981 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2982 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2983 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2984 int dw_dialog_dismiss(DWDialog *dialog, void *result)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2985 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2986 dialog->result = result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2987 dw_event_post(dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2988 dialog->done = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2989 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2990 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2991
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2992 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2993 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2994 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2995 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2996 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2997 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2998 void *dw_dialog_wait(DWDialog *dialog)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2999 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3000 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3001 void *tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3002
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3003 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3004 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3005 WinDispatchMsg(dwhab, &qmsg);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3006 if(dialog->done)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3007 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3008 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3009 dw_event_close(&dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3010 tmp = dialog->result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3011 free(dialog);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3012 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3013 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3014
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3016 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3017 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3018 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3019 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3020 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3021 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3022 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3023 int dw_messagebox(char *title, char *format, ...)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3024 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3025 va_list args;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3026 char outbuf[1024];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3027
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3028 va_start(args, format);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3029 vsprintf(outbuf, format, args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3030 va_end(args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3031
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3032 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3033
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3034 return strlen(outbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3035 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3036
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3037 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3038 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3039 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3040 * title: The title of the message box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3041 * text: The text to display in the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3042 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3043 * True if YES False of NO.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3044 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3045 int dw_yesno(char *title, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3046 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3047 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
3048 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3049 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3050 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3051
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3052 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3053 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3054 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3055 * 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
3056 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3057 int dw_window_raise(HWND handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3058 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3059 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
3060 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3061
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3062 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3063 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3064 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3065 * 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
3066 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3067 int dw_window_lower(HWND handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3068 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3069 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
3070 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3071
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3072 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3073 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3074 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3075 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3076 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3077 int dw_window_show(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3078 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3079 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3080 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3081 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3082
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
3083 _fix_button_owner(_toplevel_window(handle), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3084 WinSetFocus(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3085 _initial_focus(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3086
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3087 /* If this window has a switch list entry make sure it is visible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3088 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3089 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3090 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3091 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3092 swcntrl.uchVisibility = SWL_VISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3093 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3094 }
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3095 if(WinWindowFromID(handle, FID_CLIENT))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3096 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3097 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3098
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3099 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
3100 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3101 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
3102 int newx, newy, changed = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3103 SWP swp;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3104
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3105 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3106
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3107 WinQueryWindowPos(handle, &swp);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3108
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3109 newx = swp.x;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3110 newy = swp.y;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3111
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3112 if((swp.x+swp.cx) > cx)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3113 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3114 newx = (cx - swp.cx)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3115 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3116 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3117 if((swp.y+swp.cy) > cy)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3118 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3119 newy = (cy - swp.cy)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3120 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3121 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3122 if(changed)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3123 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
3124 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3125 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3126 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3127 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3128
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3129 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3130 * 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
3131 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3132 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3133 */
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3134 int dw_window_minimize(HWND handle)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3135 {
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3136 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
3137
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3138 if(hwndclient)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3139 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3140 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
3141
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3142 if(box)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3143 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3144 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
3145 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
3146 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3147 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3148
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3149 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
3150 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3151
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3152 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3153 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3154 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3155 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3156 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3157 int dw_window_hide(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3158 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3159 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3160 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3161
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3162 /* If this window has a switch list entry make sure it is invisible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3163 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3164 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3165 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3166 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3167 swcntrl.uchVisibility = SWL_INVISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3168 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3169 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3170 return WinShowWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3171 }
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 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3175 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3176 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3177 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3178 int dw_window_destroy(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3179 {
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
3180 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
3181 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
3182
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3183 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
3184 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
3185
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3186 if(parent != HWND_DESKTOP && thisbox && thisbox->count)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3187 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3188 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
3189 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
3190
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3191 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
3192 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3193 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
3194 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
3195 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3196
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3197 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
3198 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
3199
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3200 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
3201
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3202 /* 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
3203 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
3204 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3205 tmpitem[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
3206 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3207 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
3208 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3209 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
3210 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3211
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3212 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
3213 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
3214 thisbox->count--;
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3215 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3216 _disconnect_windows(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3217 return WinDestroyWindow(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3218 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3219
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
3220 /* 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
3221 * 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
3222 * 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
3223 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3224 void dw_window_redraw(HWND handle)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3225 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3226 HWND window = WinWindowFromID(handle, FID_CLIENT);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3227 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
3228
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3229 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
3230 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3231 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
3232
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3233 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
3234
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3235 WinShowWindow(mybox->items[0].hwnd, FALSE);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3236 _do_resize(mybox, width, height);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3237 WinShowWindow(mybox->items[0].hwnd, TRUE);
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3238 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3239 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3240
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3241 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3242 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3243 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3244 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3245 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3246 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3247 void dw_window_reparent(HWND handle, HWND newparent)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3248 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3249 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3250 WinSetParent(handle, blah ? blah : newparent, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3251 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3252
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3253 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3254 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3255 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3256 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3257 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3258 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3259 int dw_window_set_font(HWND handle, char *fontname)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3260 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3261 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3262 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3263
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3264 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3265 * Sets the colors used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3266 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3267 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3268 * fore: Foreground color in DW_RGB format or a default color index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3269 * back: Background color in DW_RGB format or a default color index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3270 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3271 int dw_window_set_color(HWND handle, ULONG fore, ULONG back)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3272 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3273 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3274 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3275 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3276
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3277 rgb2.bBlue = DW_BLUE_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3278 rgb2.bGreen = DW_GREEN_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3279 rgb2.bRed = DW_RED_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3280 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3281
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3282 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3283
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3284 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3285 if((back & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3286 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3287 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3288
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3289 rgb2.bBlue = DW_BLUE_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3290 rgb2.bGreen = DW_GREEN_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3291 rgb2.bRed = DW_RED_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3292 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3294 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3295 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3296 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3297 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3298 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3299
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3300 /* Slight conversion */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3301 if(fore == DW_CLR_BLACK)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3302 fore = CLR_BLACK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3303 if(fore == DW_CLR_WHITE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3304 fore = CLR_WHITE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3305
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3306 if(back == DW_CLR_BLACK)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3307 back = CLR_BLACK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3308 if(back == DW_CLR_WHITE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3309 back = CLR_WHITE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3310
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3311 return (WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore) |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3312 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3313 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3314
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3315 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3316 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3317 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3318 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3319 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3320 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3321 int dw_window_set_border(HWND handle, int border)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3322 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3323 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3324 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3325 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3326
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3327 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3328 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3329 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3330 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3331 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3332 void dw_window_capture(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3333 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3334 WinSetCapture(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3335 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3336
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3337 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3338 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3339 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3340 void dw_window_release(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3341 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3342 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3343 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3344
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3345 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3346 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3347 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3348 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3349 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3350 void dw_window_track(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3351 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3352 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3353 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3354
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3355 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3356 * 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
3357 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3358 * 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
3359 * 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
3360 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3361 void dw_window_pointer(HWND handle, int pointertype)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3362 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3363 WinSetPointer(handle,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3364 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
3365 pointertype,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3366 FALSE));
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3367 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3368
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3369 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3370 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3371 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3372 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3373 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3374 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3375 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3376 HWND dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3377 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3378 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
3379 Box *newbox = calloc(1, sizeof(Box));
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3380 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3382 newbox->pad = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3383 newbox->type = BOXVERT;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3384 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3385
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3386 flStyle |= FCF_NOBYTEALIGN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3387
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3388 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
3389 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
3390 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3391 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
3392
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3393 if(!(flStyle & FCF_SHELLPOSITION))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3394 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3395
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3396 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
3397 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
3398 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
3399 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3400 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3401 WinSetWindowPtr(hwndframe, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3402 WinSetWindowPtr(hwndclient, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3403
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3404 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3405 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3406
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3407 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3408 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3409 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3410 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3411 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3412 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3413 HWND dw_box_new(int type, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3414 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3415 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3416 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3417
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3418 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3419 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3420 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3421 newbox->grouphwnd = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3422
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3423 hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3424 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3425 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
3426 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
3427 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3428 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3429 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3430 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3431 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3432 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3433 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3434
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3435 newbox->oldproc = WinSubclassWindow(hwndframe, _controlproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3436 WinSetWindowPtr(hwndframe, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3437 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3438 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3439 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3440
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3441 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3442 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3443 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3444 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3445 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3446 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3447 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3448 HWND dw_groupbox_new(int type, int pad, char *title)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3449 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
3450 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3451 HWND hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3452
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3453 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3454 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3455 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3456
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3457 hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3458 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3459 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
3460 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
3461 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3462 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3463 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3464 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3465 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3466 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3467 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3468
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3469 newbox->grouphwnd = WinCreateWindow(hwndframe,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3470 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3471 title,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3472 WS_VISIBLE | SS_GROUPBOX |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3473 WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3474 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3475 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3476 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3477 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3478 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3479 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3480
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3481 WinSetWindowPtr(hwndframe, QWP_USER, newbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3482 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3483 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3484 dw_window_set_font(newbox->grouphwnd, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3485 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3486 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3487
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3488 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3489 * 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
3490 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3491 * 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
3492 */
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3493 HWND dw_mdi_new(unsigned long id)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3494 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3495 HWND hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3496
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3497 hwndframe = WinCreateWindow(HWND_OBJECT,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3498 WC_FRAME,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3499 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
3500 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
3501 FS_NOBYTEALIGN,
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3502 0,0,2000,1000,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3503 NULLHANDLE,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3504 HWND_TOP,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3505 0L,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3506 NULL,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3507 NULL);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3508 return hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3509 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3510
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3511 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3512 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3513 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3514 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3515 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3516 HWND dw_bitmap_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3517 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3518 return WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3519 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3520 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3521 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3522 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3523 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3524 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3525 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3526 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3527 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3528 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3529
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3530 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3531 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3532 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3533 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3534 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3535 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3536 HWND dw_notebook_new(ULONG id, int top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3537 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3538 ULONG flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3539 HWND tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3540
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3541 if(top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3542 flags = BKS_MAJORTABTOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3543 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3544 flags = BKS_MAJORTABBOTTOM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3545
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3546 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3547 WC_NOTEBOOK,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3548 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3549 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3550 BKS_TABBEDDIALOG |
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3551 flags,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3552 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3553 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3554 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3555 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3556 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3557 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3558
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3559 /* Fix tab sizes on Warp 3 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3560 if(!IS_WARP4())
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3561 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3562 /* 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
3563 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
3564 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3565
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3566 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3567 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3568 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3569
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3570 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3571 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3572 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3573 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3574 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3575 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3576 HMENUI dw_menu_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3577 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3578 HMENUI tmp = malloc(sizeof(struct _hmenui));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3579
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3580 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3581 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3582
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3583 tmp->menu = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3584 WC_MENU,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3585 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3586 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3587 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3588 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3589 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3590 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3591 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3592 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3593 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3594 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3595
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3596 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3597 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3598 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3599 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3600 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3601 HMENUI dw_menubar_new(HWND location)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3602 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3603 HMENUI tmp = malloc(sizeof(struct _hmenui));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3604
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3605 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3606 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3607
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3608 tmp->menu = WinCreateWindow(location,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3609 WC_MENU,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3610 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3611 WS_VISIBLE | MS_ACTIONBAR,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3612 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3613 location,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3614 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3615 FID_MENU,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3616 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3617 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3618 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3619 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3620
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3621 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3622 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3623 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3624 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3625 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3626 void dw_menu_destroy(HMENUI *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3627 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3628 if(menu && *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3629 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3630 WinDestroyWindow((*menu)->menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3631 free(*menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3632 *menu = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3633 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3634 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3635
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3636 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3637 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3638 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3639 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3640 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3641 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3642 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3643 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3644 * check: If TRUE menu is "check"able.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3645 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3646 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3647 HWND dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3648 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3649 MENUITEM miSubMenu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3650 HWND menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3651
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3652 if(!menux)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3653 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3654
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3655 menu = menux->menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3656
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3657 if(end)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3658 miSubMenu.iPosition=MIT_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3659 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3660 miSubMenu.iPosition=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3661
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3662 if(strlen(title) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3663 miSubMenu.afStyle=MIS_SEPARATOR | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3664 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3665 miSubMenu.afStyle=MIS_TEXT | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3666 miSubMenu.afAttribute=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3667 miSubMenu.id=id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3668 miSubMenu.hwndSubMenu = submenu ? submenu->menu : 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3669 miSubMenu.hItem=NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3670
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3671 WinSendMsg(menu,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3672 MM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3673 MPFROMP(&miSubMenu),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3674 MPFROMP(title));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3675 return (HWND)id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3676 }
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 * Sets the state of a menu item check.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3680 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3681 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3682 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3683 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3684 */
12
26e2130135b9 Many Win32 and GTK fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 9
diff changeset
3685 void dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3686 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3687 HWND menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3688
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3689 if(!menux)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3690 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3691
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3692 menu = menux->menu;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3693
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3694 if(check)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3695 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3696 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3697 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3698 WinSendMsg(menu, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3699 MPFROM2SHORT(MIA_CHECKED, 0));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3700 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3701
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3702 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3703 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3704 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3705 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3706 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3707 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3708 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3709 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3710 void dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3711 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3712 if(menu && *menu)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3713 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
3714 popup = parent;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3715 WinPopupMenu(HWND_DESKTOP, parent, (*menu)->menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3716 free(*menu);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3717 *menu = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3718 }
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 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3723 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3724 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3725 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3726 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3727 void dw_pointer_query_pos(long *x, long *y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3728 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3729 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3730
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3731 WinQueryPointerPos(HWND_DESKTOP, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3732 if(x && y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3733 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3734 *x = ptl.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3735 *y = dw_screen_height() - ptl.y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3736 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3737 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3738
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3739 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3740 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3741 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3742 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3743 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3744 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3745 void dw_pointer_set_pos(long x, long y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3746 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3747 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3748 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3749
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3750 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3751 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3752 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3753 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3754 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3755 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3756 HWND dw_container_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3757 {
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
3758 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3759 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3760 WC_CONTAINER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3761 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3762 WS_VISIBLE | CCS_READONLY |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3763 CCS_SINGLESEL | CCS_AUTOPOSITION,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3764 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3765 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3766 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3767 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3768 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3769 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
3770 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
3771 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3772 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3773 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3774 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3775
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3776 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3777 * 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
3778 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3779 * 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
3780 * 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
3781 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3782 HWND dw_tree_new(ULONG id)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3783 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3784 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
3785 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
3786 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
3787 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
3788 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3789 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
3790 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
3791 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
3792 NULLHANDLE,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3793 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
3794 id,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3795 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3796 NULL);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3797
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3798 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
3799 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
3800 cnrinfo.slBitmapOrIcon.cy = 16;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3801
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3802 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON));
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3803 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
3804 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
3805 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
3806 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
3807 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3808
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
3809 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3810 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3811 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3812 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3813 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3814 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3815 HWND dw_text_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3816 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3817 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3818 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3819 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3820 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3821 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3822 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3823 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3824 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3825 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3826 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3827 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3828 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3829 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3830 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3831
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3832 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3833 * 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
3834 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3835 * text: The text to be display by the static text widget.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3836 * id: An ID to be used with WinWindowFromID() or 0L.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3837 */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3838 HWND dw_status_text_new(char *text, ULONG id)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3839 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
3840 WindowData *blah = calloc(sizeof(WindowData), 1);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3841 HWND tmp = WinCreateWindow(HWND_OBJECT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3842 WC_STATIC,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3843 text,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3844 WS_VISIBLE | SS_TEXT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3845 0,0,2000,1000,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3846 NULLHANDLE,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3847 HWND_TOP,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3848 id,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3849 NULL,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3850 NULL);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3851 dw_window_set_font(tmp, DefaultFont);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3852 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
3853
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
3854 blah->oldproc = WinSubclassWindow(tmp, _statusproc);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3855 WinSetWindowPtr(tmp, QWP_USER, blah);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3856 return tmp;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3857 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3858
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
3859 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3860 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3861 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3862 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3863 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3864 HWND dw_mle_new(ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3865 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3866 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3867 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3868 WC_MLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3869 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3870 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3871 MLS_BORDER | MLS_IGNORETAB |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3872 MLS_READONLY | MLS_VSCROLL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3873 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3874 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3875 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3876 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3877 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3878 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3879 dw_window_set_font(tmp, DefaultFont);
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3880 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3881 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3882 return tmp;
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 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3887 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3888 * text: The default text to be in the entryfield widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3889 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3890 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3891 HWND dw_entryfield_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3892 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3893
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3894 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3895 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3896 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3897 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3898 WS_VISIBLE | ES_MARGIN |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3899 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3900 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3901 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3902 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3903 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3904 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3905 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3906 dw_window_set_font(tmp, DefaultFont);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3907 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3908 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3909 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3910 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3911
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3912 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3913 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3914 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3915 * text: The default text to be in the entryfield widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3916 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3917 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3918 HWND dw_entryfield_password_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3919 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3920 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3921 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3922 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3923 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3924 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3925 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3926 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3927 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3928 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3929 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3930 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3931 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3932 dw_window_set_font(tmp, DefaultFont);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3933 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3934 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3935 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3936 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3937
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3938 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3939 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3940 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3941 * text: The default text to be in the combpbox widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3942 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3943 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3944 HWND dw_combobox_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3945 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3946 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3947 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3948 WC_COMBOBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3949 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3950 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3951 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3952 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3953 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3954 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3955 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3956 NULL);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3957 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
3958 HWND child;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3959
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3960 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
3961 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3962 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
3963 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3964 WinSetWindowPtr(child, QWP_USER, moreblah);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3965 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
3966 WinEndEnumWindows(henum);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3967 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3968 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3969 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3970 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3971 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3972 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3973
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3974 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3975 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3976 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3977 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3978 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3979 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3980 HWND dw_button_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3981 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
3982 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3983
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3984 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3985 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3986 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3987 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3988 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3989 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3990 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3991 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3992 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3993 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3994
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3995 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3996 bubble->bubbletext[0] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3997 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3998
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3999 WinSetWindowPtr(tmp, QWP_USER, bubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4000 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4001 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4002 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4003
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4004 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4005 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4006 ** controls
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4007 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4008
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4009 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4010 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4011 char *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4012 int slen = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4013
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4014 *buff++ = '#';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4016 str = buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4017
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4018 do
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4019 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4020 *str++ = (ulID % 10) + '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4021 ulID /= 10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4022 slen++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4023 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4024 while(ulID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4025
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4026 *str-- = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4027
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4028 for(; str > buff; str--, buff++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4029 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4030 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4031 *str ^= *buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4032 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4033 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4034 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4035
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4036
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4037 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4038 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4039 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4040 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4041 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4042 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4043 HWND dw_bitmapbutton_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4044 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4045 char idbuf[256];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4046 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
4047 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4048
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4049 _GenResIDStr(idbuf, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4050
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4051 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4052 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4053 idbuf,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4054 WS_VISIBLE | BS_PUSHBUTTON |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4055 BS_BITMAP | BS_AUTOSIZE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4056 BS_NOPOINTERFOCUS,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4057 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4058 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4059 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4060 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4061 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4062 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4063
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4064 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4065 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4066 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4067 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4068
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4069 WinSetWindowPtr(tmp, QWP_USER, bubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4070 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4071 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4072
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4073 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4074 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4075 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4076 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4077 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4078 */
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4079 HWND dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4080 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4081 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4082 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4083 WC_SPINBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4084 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4085 WS_VISIBLE | SPBS_MASTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4086 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4087 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4088 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4089 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4090 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4091 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4092 dw_window_set_font(tmp, DefaultFont);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4093 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4094 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4095 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4096 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4097
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4098 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4099 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4100 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4101 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4102 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4103 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4104 HWND dw_radiobutton_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4105 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4106 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4107 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4108 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4109 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4110 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4111 BS_AUTORADIOBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4112 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4113 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4114 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4115 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4116 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4117 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4118 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4119 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4120 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4121 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4122 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4123 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4124
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4125
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4126 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4127 * 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
4128 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4129 * 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
4130 * increments: Number of increments available.
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4131 * id: An ID to be used with WinWindowFromID() or 0L.
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4132 */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4133 HWND dw_slider_new(int vertical, int increments, ULONG id)
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4134 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4135 WindowData *blah = calloc(1, sizeof(WindowData));
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4136 SLDCDATA sldcData = { sizeof(SLDCDATA), increments, 0, 0, 0 };
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4137 HWND tmp = WinCreateWindow(HWND_OBJECT,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4138 WC_SLIDER,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4139 "",
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4140 WS_VISIBLE | SLS_SNAPTOINCREMENT |
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4141 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL),
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4142 0,0,2000,1000,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4143 NULLHANDLE,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4144 HWND_TOP,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4145 id,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4146 &sldcData,
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4147 NULL);
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4148
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4149
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4150 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
4151 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
4152 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
4153 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4154
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4155 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4156 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4157 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4158 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4159 */
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4160 HWND dw_percent_new(ULONG id)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4161 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4162 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
4163 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
4164 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
4165 "",
62
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4166 WS_VISIBLE | SLS_READONLY
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4167 | 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
4168 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
4169 NULLHANDLE,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4170 HWND_TOP,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4171 id,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4172 NULL,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4173 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
4174 dw_window_disable(tmp);
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4175 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
4176 WinSetWindowPtr(tmp, QWP_USER, blah);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4177 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4178 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4179
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4180 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4181 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4182 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4183 * text: The text to be display by the static text widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4184 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4185 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4186 HWND dw_checkbox_new(char *text, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4187 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4188 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4189 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4190 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4191 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4192 WS_VISIBLE | BS_AUTOCHECKBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4193 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4194 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4195 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4196 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4197 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4198 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4199 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4200 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4201 bubble->id = id;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4202 bubble->bubbletext[0] = '\0';
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4203 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4204 WinSetWindowPtr(tmp, QWP_USER, bubble);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4205 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4206 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4207
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4208 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4209 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4210 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4211 * id: An ID to be used with WinWindowFromID() or 0L.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4212 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4213 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4214 HWND dw_listbox_new(ULONG id, int multi)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4215 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4216 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4217 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4218 WC_LISTBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4219 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4220 WS_VISIBLE | LS_NOADJUSTPOS |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4221 (multi ? LS_MULTIPLESEL : 0),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4222 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4223 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4224 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4225 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4226 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4227 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4228 dw_window_set_font(tmp, DefaultFont);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4229 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4230 WinSetWindowPtr(tmp, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4231 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4232 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4233
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4234 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4235 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4236 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4237 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4238 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4239 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4240 void dw_window_set_icon(HWND handle, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4241 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4242 HPOINTER icon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4243
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4244 icon = WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4245 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4246 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4247
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4248 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4249 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4250 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4251 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4252 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4253 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4254 void dw_window_set_bitmap(HWND handle, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4255 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4256 HBITMAP hbm;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4257 HPS hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4258
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4259 hbm = GpiLoadBitmap(hps, NULLHANDLE, id, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4260 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4261 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4262 /*WinSetWindowULong( hwndDlg, QWL_USER, (ULONG) hbm );*/
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4263 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4264 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4265
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4266 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4267 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4268 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4269 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4270 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4271 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4272 void dw_window_set_text(HWND handle, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4273 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4274 WinSetWindowText(handle, text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4275 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4276
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4277 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4278 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4279 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4280 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4281 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4282 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4283 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4284 char *dw_window_get_text(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4285 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4286 char tempbuf[4096] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4287
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4288 WinQueryWindowText(handle, 4095, tempbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4289 tempbuf[4095] = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4290
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4291 return strdup(tempbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4292 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4294 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4295 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4296 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4297 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4298 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4299 void dw_window_disable(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4300 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4301 WinEnableWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4302 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4303
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4304 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4305 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4306 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4307 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4308 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4309 void dw_window_enable(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4310 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4311 WinEnableWindow(handle, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4312 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4313
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4314 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4315 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4316 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4317 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4318 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4319 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4320 HWND dw_window_from_id(HWND handle, int id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4321 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4322 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4323 HWND child;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4324 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4325
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4326 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4327 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4328 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4329 int windowid = WinQueryWindowUShort(child, QWS_ID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4330 HWND found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4331
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4332 WinQueryClassName(child, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4333
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4334 /* 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
4335 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4336 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4337 return found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4339 if(windowid && windowid == id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4340 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4341 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4342 return child;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4343 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4344 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4345 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4346 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4347 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4348
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4349 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4350 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4351 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4352 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4353 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4354 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4355 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4356 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4357 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4358 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4359 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4360 void dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4361 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4362 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4363
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4364 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4365 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4366 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4367 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4369 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4370 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4371 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4372 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4373 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4374 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4375 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4376 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4377 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4378 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4379
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4380 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
4381 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4382 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4383
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4384 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4385 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4386 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4387 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4388 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4389 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4390 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4391 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4392 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4393 if(!thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4394 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4395 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4396 if(box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4397 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4398 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4399 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4400 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4401 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4402 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4403 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4404 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4405 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4406 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4407 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4408
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4409 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4410
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4411 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4412 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4413 tmpitem[z] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4414 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4415
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4416 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4417
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
4418 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4419 tmpitem[thisbox->count].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4420 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4421 tmpitem[thisbox->count].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4422
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4423 tmpitem[thisbox->count].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4424 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4425 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4426 tmpitem[thisbox->count].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4427 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4428 tmpitem[thisbox->count].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4429 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4430 tmpitem[thisbox->count].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4431
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4432 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4433 tmpitem[thisbox->count].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4434 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4435 tmpitem[thisbox->count].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4436
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4437 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4438
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4439 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4440 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4441
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4442 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4443
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4444 /* Don't set the ownership if it's an entryfield or spinbutton */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4445 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
4446 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
4447 WinSetOwner(item, box);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4448 WinSetParent(item, box, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4449 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4450 }
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 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4454 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4455 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4456 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4457 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4458 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4459 void dw_window_set_usize(HWND handle, ULONG width, ULONG height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4460 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4461 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4462 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4463
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4464 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4465 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4466 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4467 int dw_screen_width(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4468 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4469 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4470 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4471
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4472 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4473 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4474 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4475 int dw_screen_height(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4476 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4477 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
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 /* This should return the current color depth */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4481 unsigned long dw_color_depth(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4482 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4483 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4484 long colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4485
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4486 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4487 DevCloseDC(hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4488 return colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4489 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4490
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4491
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4492 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4493 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4494 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4495 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4496 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4497 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4498 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4499 void dw_window_set_pos(HWND handle, ULONG x, ULONG y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4500 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4501 int myy = _get_frame_height(handle) - (y + _get_height(handle));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4502
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4503 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4504 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4505
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4506 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4507 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4508 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4509 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4510 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4511 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4512 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4513 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4514 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4515 void dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4516 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4517 int myy = _get_frame_height(handle) - (y + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4518
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4519 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4520 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4521
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4522 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4523 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4524 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4525 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4526 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4527 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4528 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4529 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4530 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4531 void dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4532 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4533 SWP swp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4534 WinQueryWindowPos(handle, &swp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4535 if(x)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4536 *x = swp.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4537 if(y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4538 *y = _get_frame_height(handle) - (swp.y + swp.cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4539 if(width)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4540 *width = swp.cx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4541 if(height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4542 *height = swp.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4543 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4544
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4545 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4546 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4547 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4548 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4549 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4550 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4551 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4552 void dw_window_set_style(HWND handle, ULONG style, ULONG mask)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4553 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4554 WinSetWindowBits(handle, QWL_STYLE, style, mask);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4555 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4556
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4557 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4558 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4559 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4560 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4561 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4562 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4563 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4564 ULONG dw_notebook_page_new(HWND handle, ULONG flags, int front)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4565 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4566 if(front)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4567 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4568 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_FIRST));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4569 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4570 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), BKA_LAST));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4571 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4572
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4573 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4574 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4575 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4576 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4577 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4578 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4579 void dw_notebook_page_destroy(HWND handle, unsigned int pageid)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4580 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4581 WinSendMsg(handle, BKM_DELETEPAGE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4582 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4583 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4584
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4585 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4586 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4587 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4588 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4589 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4590 unsigned int dw_notebook_page_query(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4591 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4592 return (int)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4593 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4594
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4595 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4596 * Sets the currently visibale page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4597 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4598 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4599 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4600 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4601 void dw_notebook_page_set(HWND handle, unsigned int pageid)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4602 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4603 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4604 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4605
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4606 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4607 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4608 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4609 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4610 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4611 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4612 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4613 void dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4614 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4615 WinSendMsg(handle, BKM_SETTABTEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4616 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4617 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4618
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4619 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4620 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4621 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4622 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4623 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4624 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4625 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4626 void dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4627 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4628 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4629 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4630 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4631
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4632 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4633 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4634 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4635 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4636 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4637 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4638 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4639 void dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4640 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4641 HWND tmpbox = dw_box_new(BOXVERT, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4642
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4643 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4644 WinSubclassWindow(tmpbox, _wndproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4645 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4646 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4647 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4648
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4649 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4650 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4651 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4652 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4653 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4654 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4655 void dw_listbox_append(HWND handle, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4656 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4657 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4658 LM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4659 MPFROMSHORT(LIT_END),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4660 MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4661 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4662
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4663 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4664 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4665 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4666 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4667 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4668 void dw_listbox_clear(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4669 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4670 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4671 LM_DELETEALL, 0L, 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4672 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4673
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4674 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4675 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4676 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4677 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4678 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4679 int dw_listbox_count(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4680 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4681 return (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4682 LM_QUERYITEMCOUNT,0L, 0L);
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4686 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4687 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4688 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4689 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4690 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4691 void dw_listbox_set_top(HWND handle, int top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4692 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4693 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4694 LM_SETTOPINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4695 MPFROMSHORT(top),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4696 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4698
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4699 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4700 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4701 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4702 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4703 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4704 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4705 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4706 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4707 void dw_listbox_query_text(HWND handle, unsigned int index, char *buffer, unsigned int length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4708 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4709 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4710 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4711
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4712 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4713 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4714 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4715 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4716 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4717 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4718 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4719 void dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4720 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4721 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4722 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4723
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4724 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4725 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4726 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4727 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4728 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4729 unsigned int dw_listbox_selected(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4730 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4731 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
4732 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
4733 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
4734 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4735 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4736
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4737 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4738 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4739 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4740 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4741 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4742 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4743 int dw_listbox_selected_multi(HWND handle, int where)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4744 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4745 int place = where;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4746
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4747 if(where == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4748 place = LIT_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4749
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4750 place = (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4751 LM_QUERYSELECTION,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4752 MPFROMSHORT(place),0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4753 if(place == LIT_NONE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4754 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4755 return place;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4756 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4757
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4758 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4759 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4760 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4761 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4762 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4763 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4764 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4765 void dw_listbox_select(HWND handle, int index, int state)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4766 {
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
4767 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
4768
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4769 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
4770
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4771 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
4772
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
4773 /* 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
4774 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
4775 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4776 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4777
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4778 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4779 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4780 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4781 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4782 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4783 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4784 void dw_listbox_delete(HWND handle, int index)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4785 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4786 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4787 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4788
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4789 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4790 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4791 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4792 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4793 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4794 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4795 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4796 unsigned int dw_mle_import(HWND handle, char *buffer, int startpoint)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4797 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4798 unsigned long point = startpoint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4799 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4800
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4801 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4802 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4803 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4804 int amount, len = strlen(buffer), written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4805
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4806 while(written < len)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4807 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4808 if((len - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4809 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4810 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4811 amount = len - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4813 memcpy(mlebuf, &buffer[written], amount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4814 mlebuf[amount] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4815
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4816 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4817 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4818 dw_mle_delete(handle, point, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4819
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4820 written += amount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4821 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4822 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4823 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4824 return point - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4825 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4826
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4827 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4828 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4829 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4830 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4831 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4832 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4833 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4834 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4835 void dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4836 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4837 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4838
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4839 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4840 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4841 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4842 int amount, copied, written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4843
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4844 while(written < length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4845 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4846 if((length - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4847 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4848 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4849 amount = length - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4850
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4851 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4852 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4853
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4854 if(copied)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4855 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4856 memcpy(&buffer[written], mlebuf, copied);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4857
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4858 written += copied;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4859 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4860 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4861 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4862 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4863 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4864 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4865 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4866
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4867 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4868 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4869 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4870 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4871 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4872 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4873 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4874 void dw_mle_query(HWND handle, unsigned long *bytes, unsigned long *lines)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4875 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4876 if(bytes)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4877 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4878 if(lines)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4879 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4880 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4881
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4882 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4883 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4884 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4885 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4886 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4887 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4888 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4889 void dw_mle_delete(HWND handle, int startpoint, int length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4890 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4891 char *buf = malloc(length+1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4892 int z, dellen = length;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4893
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4894 dw_mle_export(handle, buf, startpoint, length);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4895
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4896 for(z=0;z<length-1;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4897 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4898 if(strncmp(&buf[z], "\r\n", 2) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4899 dellen--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4900 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4901 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4902 free(buf);
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4906 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4907 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4908 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4909 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4910 void dw_mle_clear(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4911 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4912 unsigned long bytes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4913
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4914 dw_mle_query(handle, &bytes, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4915
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4916 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4917 }
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 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4921 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4922 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4923 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4924 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4925 void dw_mle_set_visible(HWND handle, int line)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4926 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4927 int tmppnt;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4928
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4929 if(line > 10)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4930 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4931 tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line - 10), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4932 WinSendMsg(handle, MLM_SETFIRSTCHAR, MPFROMLONG(tmppnt), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4933 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4934 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4935
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4936 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4937 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4938 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4939 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4940 * 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
4941 */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4942 void dw_mle_set_editable(HWND handle, int state)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4943 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4944 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4945 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4946
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4947 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4948 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4949 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4950 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4951 * 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
4952 */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4953 void dw_mle_set_word_wrap(HWND handle, int state)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4954 {
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
4955 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4956 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4957
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4958 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4959 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4960 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4961 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4962 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4963 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4964 void dw_mle_set(HWND handle, int point)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4965 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4966 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4967 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4968
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4969 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4970 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4971 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4972 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4973 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4974 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4975 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4976 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4977 int dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4978 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4979 MLE_SEARCHDATA msd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4980
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
4981 /* 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
4982 * 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
4983 */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4984 msd.cb = sizeof(msd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4985 msd.pchFind = text;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4986 msd.pchReplace = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4987 msd.cchFind = strlen(text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4988 msd.cchReplace = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4989 msd.iptStart = point;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4990 msd.iptStop = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4991
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4992 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4993 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4994 return 0;
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 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4999 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5000 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5001 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5002 void dw_mle_freeze(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5003 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5004 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5005 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5006
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5007 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5008 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5009 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5010 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5011 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5012 void dw_mle_thaw(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5013 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5014 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5015 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5016
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5017 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5018 * Returns the range of the percent bar.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5019 * 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
5020 * handle: Handle to the percent bar to be queried.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5021 */
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5022 unsigned int dw_percent_query_range(HWND handle)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5023 {
62
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
5024 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5025 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5026
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5027 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5028 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5029 * 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
5030 * 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
5031 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5032 */
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5033 void dw_percent_set_pos(HWND handle, unsigned int position)
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5034 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5035 _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
5036 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)position);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5037 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5038
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5039 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5040 * 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
5041 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5042 * 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
5043 */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5044 unsigned int dw_slider_query_pos(HWND handle)
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5045 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5046 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
5047 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5048
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5049 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5050 * 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
5051 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5052 * 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
5053 * 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
5054 */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5055 void dw_slider_set_pos(HWND handle, unsigned int position)
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5056 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5057 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
5058 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
5059 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5060
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5061 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5062 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5063 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5064 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5065 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5066 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5067 void dw_spinbutton_set_pos(HWND handle, long position)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5068 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5069 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L);
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 * Sets the spinbutton limits.
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 spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5076 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5077 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5078 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5079 void dw_spinbutton_set_limits(HWND handle, long upper, long lower)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5080 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5081 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5082 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5083
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5084 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5085 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5086 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5087 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5088 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5089 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5090 void dw_entryfield_set_limit(HWND handle, ULONG limit)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5091 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5092 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5093 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5094
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5095
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5096 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5097 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5098 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5099 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5100 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5101 long dw_spinbutton_query(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5102 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5103 long tmpval = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5104
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5105 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5106 return tmpval;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5107 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5108
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5109 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5110 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5111 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5112 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5113 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5114 int dw_checkbox_query(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5115 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5116 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5117 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5118
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5119 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5120 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5121 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5122 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5123 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5124 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5125 void dw_checkbox_set(HWND handle, int value)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5126 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5127 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5128 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5129
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5130 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5131 * 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
5132 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5133 * 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
5134 * 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
5135 * 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
5136 * 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
5137 * 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
5138 * 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
5139 */
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5140 HWND dw_tree_insert_after(HWND handle, HWND item, char *title, unsigned long icon, HWND parent, void *itemdata)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5141 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5142 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
5143 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
5144 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
5145
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5146 if(!item)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5147 item = CMA_FIRST;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5148
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5149 /* 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
5150 * 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
5151 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5152
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5153 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
5154
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5155 /* 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
5156
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5157 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
5158
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5159 /* 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
5160
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5161 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
5162 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
5163 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
5164
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5165 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
5166 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
5167
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5168 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
5169
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5170 ri.cb = sizeof(RECORDINSERT);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5171 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
5172 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
5173 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
5174 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
5175 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
5176
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5177 /* 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
5178 * 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
5179 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5180 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
5181
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5182 /* 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
5183 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
5184
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5185 return (HWND)pci;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5186 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5187
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5188 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5189 * 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
5190 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5191 * 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
5192 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5193 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5194 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5195 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5196 */
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5197 HWND dw_tree_insert(HWND handle, char *title, unsigned long icon, HWND parent, void *itemdata)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5198 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5199 return dw_tree_insert_after(handle, (HWND)CMA_END, title, icon, parent, itemdata);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5200 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5201
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5202 /*
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
5203 * 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
5204 * 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
5205 * 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
5206 * 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
5207 * 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
5208 * 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
5209 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5210 void dw_tree_set(HWND handle, HWND item, char *title, unsigned long icon)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5211 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5212 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
5213
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5214 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
5215 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
5216
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5217 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
5218 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
5219
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5220 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
5221 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
5222
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5223 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
5224
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5225 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
5226 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5227
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5228 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5229 * 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
5230 * 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
5231 * 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
5232 * 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
5233 * 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
5234 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5235 void dw_tree_set_data(HWND handle, HWND item, void *itemdata)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5236 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5237 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
5238
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5239 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
5240 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
5241
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5242 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
5243 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5244
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5245 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5246 * 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
5247 * 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
5248 * 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
5249 * 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
5250 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5251 void dw_tree_item_select(HWND handle, HWND item)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5252 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5253 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
5254
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5255 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
5256 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5257 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
5258 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
5259 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
5260 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5261 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
5262 lastitem = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5263 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
5264 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5265
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5266 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5267 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5268 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5269 * 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
5270 */
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5271 void dw_tree_clear(HWND handle)
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5272 {
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5273 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, CMA_INVALIDATE | CMA_FREE));
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5274 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5275
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5276 /*
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
5277 * 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
5278 * 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
5279 * 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
5280 * 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
5281 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5282 void dw_tree_expand(HWND handle, HWND item)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5283 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5284 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
5285 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5286
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5287 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5288 * 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
5289 * 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
5290 * 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
5291 * 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
5292 */
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5293 void dw_tree_collapse(HWND handle, HWND item)
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5294 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5295 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
5296 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5297
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
5298 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5299 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5300 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5301 * 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
5302 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5303 */
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5304 void dw_tree_delete(HWND handle, HWND item)
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5305 {
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5306 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
5307
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5308 if(!item)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5309 return;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5310
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5311 if(pci->rc.pszIcon)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5312 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5313 free(pci->rc.pszIcon);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5314 pci->rc.pszIcon = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5315 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
5316
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5317 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
5318 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
5319
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5320 /* 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
5321 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
5322 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
5323 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
5324 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
5325 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5326
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5327 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5328 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5329 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5330 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5331 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5332 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5333 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5334 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5335 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5336 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5337 int dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5338 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5339 PFIELDINFO details, first, left = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5340 FIELDINFOINSERT detin;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5341 CNRINFO cnri;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5342 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5343 ULONG size = sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5344 ULONG *offStruct = malloc(count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5345 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
5346 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
5347 ULONG *oldflags = blah ? blah->data : 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5348
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5349 if(!offStruct || !tempflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5350 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5351
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5352 memcpy(tempflags, flags, count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5353 tempflags[count] = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5354
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
5355 blah->data = tempflags;
70
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5356 blah->flags = separator;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5357
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5358 if(oldflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5359 free(oldflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5360
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5361 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5362 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5363 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5364 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5365
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5366 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5367 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5368 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5369 offStruct[z] = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5370 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5371 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5372 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5373 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5374 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5375 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5376 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5377 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5378 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5379 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5382 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5383
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5384 if(!first)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5385 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5386 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5387 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5388 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5389
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5390 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5391 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5392 if(z==separator-1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5393 left=details;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5394 details->cb = sizeof(FIELDINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5395 details->flData = flags[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5396 details->flTitle = CFA_FITITLEREADONLY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5397 details->pTitleData = titles[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5398 details->offStruct = offStruct[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5399 details = details->pNextFieldInfo;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5400 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5401
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5402 detin.cb = sizeof(FIELDINFOINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5403 detin.fInvalidateFieldInfo = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5404 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5405 detin.cFieldInfoInsert = (ULONG)count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5406
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5407 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5408
18
f1002d51d959 Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 16
diff changeset
5409 if(count > separator && separator > 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5410 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5411 cnri.cb = sizeof(CNRINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5412 cnri.pFieldInfoLast = left;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5413 cnri.xVertSplitbar = 150;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5414
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5415 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5416 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5417
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5418 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5419 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5420 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5421
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5422 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5423 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5424 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5425 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5426 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5427 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5428 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5429 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5430 int dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5431 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5432 char **newtitles = malloc(sizeof(char *) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5433 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5434
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5435 newtitles[0] = "Icon";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5436 newtitles[1] = "Filename";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5437
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5438 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5439 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5440
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5441 memcpy(&newtitles[2], titles, sizeof(char *) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5442 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5443
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5444 dw_container_setup(handle, newflags, newtitles, count + 2, 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5445
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5446 free(newtitles);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5447 free(newflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5448 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5449 }
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 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5453 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5454 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5455 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5456 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5457 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5458 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5459 unsigned long dw_icon_load(unsigned long module, unsigned long id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5460 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5461 return WinLoadPointer(HWND_DESKTOP,module,id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5462 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5463
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5464 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5465 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5466 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5467 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5468 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5469 void dw_icon_free(unsigned long handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5470 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5471 WinDestroyPointer(handle);
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5475 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5476 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5477 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5478 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5479 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5480 void *dw_container_alloc(HWND handle, int rowcount)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5481 {
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
5482 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
5483 ULONG *flags = wd ? wd->data : 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5484 int z, size = 0, totalsize, count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5485 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
5486 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
5487 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
5488
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5489 if(!flags || rowcount < 1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5490 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5491
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5492 while(flags[count])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5493 count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5494
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5495 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5496 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5497 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5498 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5499 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5500 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5501 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5502 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5503 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5504 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5505 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5506 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5507 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5508 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5509
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5510 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5511
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
5512 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
5513
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5514 while((blah = (void *)WinSendMsg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount))) == NULL)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5515 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5516 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5517 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5518 break;
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5519 dw_main_sleep(1);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5520 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5521
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5522 if(!blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5523 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5524
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5525 temp = (PRECORDCORE)blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5526
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5527 for(z=0;z<rowcount;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5528 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5529 temp->cb = totalsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5530 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5531 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5532
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5533 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
5534
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5535 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
5536 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
5537 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
5538
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5539 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5540 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5541
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5542 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5543 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5544 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5545 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5546 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5547 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5548 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5549 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5550 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5551 void dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5552 {
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
5553 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
5554 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
5555 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
5556 ContainerInfo *ci = (ContainerInfo *)pointer;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5557 PRECORDCORE temp;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5558 CNRINFO cnr;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5559 void *dest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5560
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5561 if(!ci)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5562 return;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5563
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5564 if(!flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5565 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5566
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5567 temp = (PRECORDCORE)ci->data;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5568
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5569 z = 0;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5570
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5571 while(WinSendMsg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0)
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5572 {
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5573 z++;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5574 if(z > 5000000)
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5575 return;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5576 dw_main_sleep(1);
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5577 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5578 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
5579
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5580 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5581 for(z=0;z<column;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5582 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5583 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5584 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5585 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5586 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5587 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5588 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5589 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5590 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5591 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5592 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5593 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5594
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5595 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5596
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5597 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5598 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5599
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5600 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5601
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5602 if(flags[column] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5603 memcpy(dest, data, sizeof(HPOINTER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5604 else if(flags[column] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5605 memcpy(dest, data, sizeof(char *));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5606 else if(flags[column] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5607 memcpy(dest, data, sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5608 else if(flags[column] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5609 memcpy(dest, data, sizeof(CDATE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5610 else if(flags[column] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5611 memcpy(dest, data, sizeof(CTIME));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5612 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5613
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5614 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5615 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5616 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5617 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5618 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5619 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5620 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5621 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5622 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5623 void dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5624 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5625 dw_container_set_item(handle, pointer, 0, row, (void *)&icon);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5626 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5627 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5628
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5629 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5630 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5631 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5632 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5633 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5634 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5635 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5636 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5637 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5638 void dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5639 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5640 dw_container_set_item(handle, pointer, column + 2, row, data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5641 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5642
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5643 /*
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 * 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
5645 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5646 * 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
5647 * 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
5648 * 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
5649 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5650 void dw_container_set_column_width(HWND handle, int column, int width)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
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 }
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 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5655 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5656 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5657 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5658 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5659 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5660 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5661 void dw_container_set_row_title(void *pointer, int row, char *title)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5662 {
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5663 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
5664 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
5665 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
5666 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
5667
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5668 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5669 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5670
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
5671 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
5672
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5673 z = 0;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5674
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5675 while(WinSendMsg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO))) == 0)
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5676 {
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5677 z++;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5678 if(z > 5000000)
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5679 return;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5680 dw_main_sleep(1);
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5681 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5682 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
5683
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5684 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5685 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5686
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5687 temp->pszIcon = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5688 temp->pszName = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5689 temp->pszText = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5690 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5691
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5692 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5693 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5694 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5695 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5696 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5697 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5698 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5699 void dw_container_insert(HWND handle, void *pointer, int rowcount)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5700 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5701 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
5702 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
5703 int z;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5704
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5705 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5706 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
5707
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5708 recin.cb = sizeof(RECORDINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5709 recin.pRecordOrder = (PRECORDCORE)CMA_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5710 recin.pRecordParent = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5711 recin.zOrder = CMA_TOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5712 recin.fInvalidateRecord = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5713 recin.cRecordsInsert = rowcount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5714
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
5715 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
5716
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5717 while(WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin)) == 0)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5718 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5719 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5720 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5721 break;
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5722 dw_main_sleep(1);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5723 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5724
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5725 free(ci);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5726 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5727
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5728 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5729 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5730 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5731 * 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
5732 * 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
5733 */
0804483f6320 Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 49
diff changeset
5734 void dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5735 {
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
5736 int z = 0;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5737
52
0804483f6320 Added a redraw parameter to dw_container_clear().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 49
diff changeset
5738 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE)) == -1)
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5739 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5740 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5741 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5742 break;
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5743 dw_main_sleep(1);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5744 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5745 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5746
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5747 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5748 * 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
5749 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5750 * 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
5751 * 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
5752 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5753 void dw_container_delete(HWND handle, int rowcount)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5754 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5755 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5756 int current = 1, z;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5757
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5758 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
5759
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5760 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
5761 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5762 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
5763 current++;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5764 }
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5765
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5766 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
5767
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5768 while((int)WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | CMA_FREE)) == -1)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5769 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5770 z++;
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5771 if(z > 5000000)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5772 break;
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
5773 dw_main_sleep(1);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5774 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5775
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5776 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
5777 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5778
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5779 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5780 * 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
5781 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5782 * 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
5783 * 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
5784 * 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
5785 * 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
5786 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5787 void dw_container_scroll(HWND handle, int direction, long rows)
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5788 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5789 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
5790 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5791 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
5792 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
5793 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5794 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
5795 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
5796 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5797 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5798 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5799
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5800 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5801 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5802 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5803 * handle: Handle to the window (widget) to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5804 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5805 void dw_container_set_view(HWND handle, unsigned long flags, int iconwidth, int iconheight)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5806 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5807 CNRINFO cnrinfo;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5808
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5809 cnrinfo.flWindowAttr = flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5810 cnrinfo.slBitmapOrIcon.cx = iconwidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5811 cnrinfo.slBitmapOrIcon.cy = iconheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5813 WinSendMsg(handle, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5814 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5815
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5816 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5817 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5818 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5819 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5820 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5821 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5822 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5823 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5824 char *dw_container_query_start(HWND handle, unsigned long flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5825 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5826 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5827 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5828 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5829 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5830 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5831 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5832 {
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5833 if(pCore->flRecordAttr & flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5834 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5835 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5836 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5837 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5838 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5839 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5840 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5841 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5842 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5843
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5844 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5845 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5846 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5847 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5848 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5849 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5850 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5851 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5852 char *dw_container_query_next(HWND handle, unsigned long flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5853 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5854 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5855 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5856 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5857 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5858 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5859 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5860 {
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5861 if(pCore->flRecordAttr & flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5862 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5863
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5864 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5865 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5866 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5867 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5868 return pCore->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5869 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5870 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5871 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5872
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5873 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5874 * 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
5875 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5876 * 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
5877 * 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
5878 */
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5879 void dw_container_cursor(HWND handle, char *text)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5880 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5881 RECTL viewport, item;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5882
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5883 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
5884 while(pCore)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5885 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5886 if(pCore->pszIcon == text)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5887 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5888 QUERYRECORDRECT qrr;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5889 int scrollpixels = 0, midway;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5890
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5891 qrr.cb = sizeof(QUERYRECORDRECT);
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5892 qrr.pRecord = pCore;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5893 qrr.fRightSplitWindow = 0;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5894 qrr.fsExtent = CMA_TEXT;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5895
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5896 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
5897 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
5898 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
5899
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5900 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
5901 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
5902
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5903 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
5904 return;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5905 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5906
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5907 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
5908 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5909 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5910
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5911 /*
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5912 * 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
5913 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5914 * 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
5915 */
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5916 void dw_container_optimize(HWND handle)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5917 {
70
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5918 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
5919 RECTL item;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5920 PRECORDCORE pCore = NULL;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5921 int max = 0;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5922
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5923 if(blah && !blah->flags)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5924 return;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5925
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5926 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
5927 while(pCore)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5928 {
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5929 QUERYRECORDRECT qrr;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5930 int vector;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5931
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5932 qrr.cb = sizeof(QUERYRECORDRECT);
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5933 qrr.pRecord = pCore;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5934 qrr.fRightSplitWindow = 0;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5935 qrr.fsExtent = CMA_TEXT;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5936
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5937 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
5938
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5939 vector = item.xRight - item.xLeft;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5940
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5941 if(vector > max)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5942 max = vector;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5943
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5944 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
5945 }
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5946
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5947 if(max)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5948 {
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5949 CNRINFO cnri;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5950
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5951 cnri.cb = sizeof(CNRINFO);
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5952 cnri.xVertSplitbar = max;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5953
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
5954 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
5955 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5956 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5957
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
5958 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5959 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5960 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5961 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5962 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5963 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5964 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5965 HWND dw_render_new(unsigned long id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5966 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5967 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5968 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5969 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
5970 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
5971 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5972 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5973 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5974 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5975 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5976 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5977 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5978 WinSubclassWindow(hwndframe, _RendProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5979 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5980 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5981
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5982 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5983 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5984 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5985 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5986 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5987 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5988 void dw_color_foreground_set(unsigned long value)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5989 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5990 _foreground = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5991 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5992
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5993 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5994 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5995 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5996 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5997 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5998 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5999 void dw_color_background_set(unsigned long value)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6000 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6001 _background = DW_RED_VALUE(value) << 16 | DW_GREEN_VALUE(value) << 8 | DW_BLUE_VALUE(value);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6002 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6003
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6004 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6005 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6006 LONG alTable[18];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6007
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6008 GpiQueryLogColorTable(hps, 0L, 0L, 18L, alTable);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6009
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6010 alTable[16] = _foreground;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6011 alTable[17] = _background;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6012
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6013 GpiCreateLogColorTable(hps,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6014 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6015 LCOLF_CONSECRGB,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6016 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6017 18,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6018 alTable);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6019 GpiSetColor(hps, 16);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6020 GpiSetBackColor(hps, 17);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6021 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6022 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6023
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6024 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6025 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6026 HPS hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6027
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6028 _set_hps(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6029 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6030 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6031
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6032 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6033 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6034 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6035 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6036 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6037 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6038 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6039 void dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6040 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6041 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6042 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6043 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6044
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6045 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6046 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6047 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6048 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6049 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6050 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6051 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6052 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6053 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6054 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6055 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6056 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6057
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6058 ptl.x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6059 ptl.y = height - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6060
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6061 GpiSetPel(hps, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6062 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6063 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6064 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6065
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6066 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6067 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6068 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6069 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6070 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6071 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6072 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6073 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6074 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6075 void dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6076 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6077 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6078 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6079 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6080
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6081 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6082 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6083 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6084 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6085 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6086 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6087 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6088 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6089 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6090 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6091 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6092 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6093
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6094 ptl[0].x = x1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6095 ptl[0].y = height - y1 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6096 ptl[1].x = x2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6097 ptl[1].y = height - y2 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6098
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6099 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6100 GpiLine(hps, &ptl[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6101
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6102 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6103 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6104 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6105
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6106
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6107 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
6108 {
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6109 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
6110 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
6111 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
6112
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6113 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
6114
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6115 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
6116
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6117 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
6118 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
6119 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
6120
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6121 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
6122 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
6123
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6124 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
6125 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
6126 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
6127 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6128
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6129 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6130 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6131 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6132 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6133 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6134 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6135 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6136 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6137 void dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6138 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6139 HPS hps;
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6140 int size = 9, z, height;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6141 RECTL rcl;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6142 char fontname[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6143
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6144 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6145 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6146 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6147 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6148 _GetPPFont(handle, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6150 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6151 {
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6152 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
6153
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6154 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6155 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6156 _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
6157 _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
6158 WinReleasePS(pixmaphps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6159 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6160 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6161 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6162
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6163 for(z=0;z<strlen(fontname);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6164 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6165 if(fontname[z]=='.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6166 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6167 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6168 size = atoi(fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6169
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6170 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
6171 rcl.yTop = height - y;
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6172 rcl.yBottom = rcl.yTop - (size*2);
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6173 rcl.xRight = rcl.xLeft + (size * strlen(text));
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6174
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
6175 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
6176
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6177 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6178 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6179 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6180
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
6181 /* 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
6182 * 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
6183 * 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
6184 * 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
6185 * 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
6186 * 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
6187 * 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
6188 */
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
6189 void dw_font_text_extents(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height)
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6190 {
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6191 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
6192 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
6193
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6194 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
6195 {
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6196 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
6197 }
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6198 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
6199 {
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6200 HPS 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
6201
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6202 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
6203 _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
6204 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
6205 }
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6206 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
6207 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
6208
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6209 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
6210
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6211 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
6212 *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
6213
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6214 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
6215 *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
6216
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
6217 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
6218 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
6219 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6220
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6221 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6222 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6223 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6224 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6225 * fill: Fill box TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6226 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6227 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6228 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6229 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6230 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6231 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6232 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6233 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6234 int thisheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6235 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6236
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6237 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6238 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6239 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6240 thisheight = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6241 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6242 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6243 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6244 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6245 thisheight = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6246 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6247 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6248 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6249
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6250 ptl[0].x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6251 ptl[0].y = thisheight - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6252 ptl[1].x = x + width - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6253 ptl[1].y = thisheight - y - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6254
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6255 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6256 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6257
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6258 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6259 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6260 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6261
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6262 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6263 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6264 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6265 void dw_flush(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6266 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6267 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6268
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6269 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6270 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6271 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6272 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6273 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6274 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6275 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6276 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6277 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6278 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6279 HPIXMAP dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6280 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6281 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6282 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6283 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6284 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6285 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6286 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6287 LONG cPlanes, cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6288
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6289 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6290 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6291
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6292 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6293
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6294 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6295 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6296
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6297 pixmap->handle = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6298 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6299 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6300
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6301 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6302 if (!depth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6303 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6304 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6305 depth = cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6306 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6307
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6308 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6309 bmih.cbFix = sizeof(BITMAPINFOHEADER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6310 bmih.cx = (SHORT)width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6311 bmih.cy = (SHORT)height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6312 bmih.cPlanes = (SHORT)cPlanes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6313 bmih.cBitCount = (SHORT)depth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6314
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6315 pixmap->width = width; pixmap->height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6316
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6317 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6318
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6319 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6320
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6321 if (depth>8)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6322 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6323
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6324 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6325
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6326 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6327 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6328
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6329 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6330 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6331 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6332 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6333 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6334 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6335 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6336 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6337 HPIXMAP dw_pixmap_grab(HWND handle, ULONG id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6338 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6339 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6340 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6341 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6342 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6343 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6344 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6345
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6346 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6347 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6348
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6349 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6350
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6351 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6352 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6353
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6354 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6355 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6356
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6357 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6358
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6359 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6360
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6361 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6362
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6363 pixmap->width = bmih.cx; pixmap->height = bmih.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6364
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6365 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6366
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6367 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6369
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6370 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6371 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6372 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6373 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6374 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6375 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6376 void dw_pixmap_destroy(HPIXMAP pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6377 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6378 GpiSetBitmap(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6379 GpiDeleteBitmap(pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6380 GpiAssociate(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6381 GpiDestroyPS(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6382 DevCloseDC(pixmap->hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6383 free(pixmap);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6384 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6385
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6386 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6387 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6388 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6389 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6390 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6391 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6392 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6393 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6394 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6395 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6396 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6397 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6398 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6399 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6400 void dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6401 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6402 HPS hpsdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6403 HPS hpssrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6404 POINTL ptl[4];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6405 int destheight, srcheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6406
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6407 if(dest)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6408 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6409 hpsdest = WinGetPS(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6410 destheight = _get_height(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6411 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6412 else if(destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6413 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6414 hpsdest = destp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6415 destheight = destp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6416 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6417 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6418 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6419
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6420 if(src)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6421 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6422 hpssrc = WinGetPS(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6423 srcheight = _get_height(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6424 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6425 else if(srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6426 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6427 hpssrc = srcp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6428 srcheight = srcp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6429 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6430 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6431 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6432 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6433 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6434 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6435 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6436
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6437 ptl[0].x = xdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6438 ptl[0].y = (destheight - ydest) - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6439 ptl[1].x = ptl[0].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6440 ptl[1].y = destheight - ydest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6441 ptl[2].x = xsrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6442 ptl[2].y = srcheight - (ysrc + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6443 ptl[3].x = ptl[2].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6444 ptl[3].y = ptl[2].y + height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6445
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6446 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6447
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6448 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6449 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6450 if(!srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6451 WinReleasePS(hpssrc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6452 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6453
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6454 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6455 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6456 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6457 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6458 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6459 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6460 void dw_beep(int freq, int dur)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6461 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6462 DosBeep(freq, dur);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6463 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6464
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6465 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6466 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6467 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6468 HMTX dw_mutex_new(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6469 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6470 HMTX mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6471
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6472 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6473 return mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6474 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6475
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6476 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6477 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6478 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6479 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6480 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6481 void dw_mutex_close(HMTX mutex)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6482 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6483 DosCloseMutexSem(mutex);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6484 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6485
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6486 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6487 * 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
6488 * 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
6489 * while blocking.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6490 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6491 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6492 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6493 void dw_mutex_lock(HMTX mutex)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6494 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6495 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
6496 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6497 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
6498
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6499 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
6500 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6501 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
6502 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
6503 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6504 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6505 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6506 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6507 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6508
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6509 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6510 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6511 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6512 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6513 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6514 void dw_mutex_unlock(HMTX mutex)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6515 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6516 DosReleaseMutexSem(mutex);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6517 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6518
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6519 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6520 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6521 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6522 HEV dw_event_new(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6523 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6524 HEV blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6525
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6526 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6527 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6528
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6529 return blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6530 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6531
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6532 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6533 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6534 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6535 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6536 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6537 int dw_event_reset(HEV eve)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6538 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6539 ULONG count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6540
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6541 if(DosResetEventSem(eve, &count))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6542 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6543 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6544 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6545
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6546 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6547 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6548 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6549 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6550 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6551 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6552 int dw_event_post(HEV eve)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6553 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6554 if(DosPostEventSem(eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6555 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6556 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6557 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6558
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6559
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6560 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6561 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6562 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6563 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6564 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6565 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6566 int dw_event_wait(HEV eve, unsigned long timeout)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6567 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6568 int rc = DosWaitEventSem(eve, timeout);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6569 if(!rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6570 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6571 if(rc == ERROR_TIMEOUT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6572 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6573 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6574 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6575
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6576 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6577 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6578 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6579 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6580 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6581 int dw_event_close(HEV *eve)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6582 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6583 if(!eve || ~DosCloseEventSem(*eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6584 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6585 return TRUE;
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6589 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6590 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6591 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6592 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6593 HAB thishab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6594 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6595 void (*threadfunc)(void *) = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6596 void **tmp = (void **)data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6597
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6598 threadfunc = (void (*)(void *))tmp[0];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6599 threadfunc(tmp[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6600
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6601 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6602
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6603 WinDestroyMsgQueue(thishmq);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6604 WinTerminate(thishab);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6605 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6606
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6607 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6608 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6609 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6610 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6611 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6612 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6613 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6614 DWTID dw_thread_new(void *func, void *data, int stack)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6615 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6616 void **tmp = malloc(sizeof(void *) * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6617
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6618 tmp[0] = func;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6619 tmp[1] = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6620
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6621 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6622 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6623
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6624 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6625 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6626 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6627 void dw_thread_end(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6628 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6629 _endthread();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6630 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6631
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6632 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6633 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6634 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6635 DWTID dw_thread_id(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6636 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6637 return (DWTID)_threadid;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6638 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6639
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6640 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6641 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6642 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6643 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6644 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6645 void dw_exit(int exitcode)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6646 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6647 /* In case we are in a signal handler, don't
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6648 * try to free memory that could possibly be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6649 * free()'d by the runtime already.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6650 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6651 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6652 Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6653 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6654 exit(exitcode);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6655 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6656
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6657 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6658 * Pack a splitbar (sizer) into the specified box from the start.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6659 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6660 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6661 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6662 void dw_box_pack_splitbar_start(HWND box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6663 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6664 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6665
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6666 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6667 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6668 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6669 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6670 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6671 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6672 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6673 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6674 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6676 SplitbarClassName,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6677 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6678 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6679 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6680 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6681 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6682 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6683 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6684 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6685 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6686 dw_box_pack_start(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6687 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6688 dw_box_pack_start(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6689
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6690 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6691 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6692
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6693 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6694 * Pack a splitbar (sizer) into the specified box from the end.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6695 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6696 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6697 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6698 void dw_box_pack_splitbar_end(HWND box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6699 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6700 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6701
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6702 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6703 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6704 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6705 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6706 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6707 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6708 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6709 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6710 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6711 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6712 SplitbarClassName,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6713 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6714 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6715 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6716 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6717 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6718 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6719 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6720 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6721 if(thisbox->type == BOXVERT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6722 dw_box_pack_end(box, tmp, 1, SPLITBAR_WIDTH, TRUE, FALSE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6723 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6724 dw_box_pack_end(box, tmp, SPLITBAR_WIDTH, 1, FALSE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6725
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6726 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6727 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6728
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6729 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6730 * Pack windows (widgets) into a box from the start (or top).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6731 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6732 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6733 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6734 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6735 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6736 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6737 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6738 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6739 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6740 void dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6741 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6742 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6743
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6744 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6745 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6746 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6747 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6748 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6749 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6750 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6751 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6752 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6753 if(thisbox->type == BOXHORZ)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6754 dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6755 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6756 dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6757 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6758 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6759
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6760 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
6761 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6762 Box *thisbox;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6763
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6764 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6765 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6766 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6767 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6768 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6769 vsize = TRUE;
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 thisbox = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6773 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6774 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6775 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6776 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6777 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6778
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6779 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6780
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6781 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6782 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6783 tmpitem[z+1] = thisitem[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6784 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6785
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6786 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6787
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
6788 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6789 tmpitem[0].type = TYPEBOX;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6790 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6791 tmpitem[0].type = TYPEITEM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6792
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6793 tmpitem[0].hwnd = item;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6794 tmpitem[0].origwidth = tmpitem[0].width = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6795 tmpitem[0].origheight = tmpitem[0].height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6796 tmpitem[0].pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6797 if(hsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6798 tmpitem[0].hsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6799 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6800 tmpitem[0].hsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6801
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6802 if(vsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6803 tmpitem[0].vsize = SIZEEXPAND;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6804 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6805 tmpitem[0].vsize = SIZESTATIC;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6806
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6807 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6808
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6809 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6810 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6811
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6812 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6813
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6814 WinQueryClassName(item, 99, tmpbuf);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
6815 /* 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
6816 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
6817 WinSetOwner(item, box);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6818 WinSetParent(item, box, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6819 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6820 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6821
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6822 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6823 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6824 char* pchStart = pchBuffer;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6825 char* pchEnd = pchStart + ulSize - 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6826
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6827 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6828 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6829 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6830 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6831 *pchEnd-- = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6832 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6833 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6834 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6835 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6836 ULONG ulMajor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6837 ULONG ulMinor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6838
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6839 char* pch = pchEnd + 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6840 while (!isdigit (*pch) && *pch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6841 pch++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6842
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6843 while (isdigit (*pch))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6844 ulMajor = ulMajor * 10 + *pch++ - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6845
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6846 if (*pch == '.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6847 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6848 while (isdigit (*++pch))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6849 ulMinor = ulMinor * 10 + *pch - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6850 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6851 return ((ulMajor << 16) | ulMinor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6852 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6853 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6854 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6855 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6856 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6857 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6858 return (0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6859 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6860
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6861 ULONG _GetSystemBuildLevel(void) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6862 /* 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
6863 * 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
6864 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6865 ULONG ulBootDrive = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6866 ULONG ulBuild = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6867 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6868 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6869 char achFileName[11] = { (char)('A'+ulBootDrive-1),':','\\','O','S','2','K','R','N','L','\0' };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6870 HFILE hfile;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6871 ULONG ulResult;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6872 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
6873 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6874 ULONG ulFileSize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6875 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6876 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6877 const ULONG ulFirstTry = min (256, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6878 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6879 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6880 char *pchBuffer = malloc(ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6881 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6882 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6883 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6884 if (ulBuild == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6885 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6886 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6887 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6888 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6889 pchBuffer = malloc(ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6890
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6891 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6892 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6893 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6894 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6895 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6896 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6897 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6898 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6899 DosClose (hfile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6900 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6901 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6902 return (ulBuild);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6903 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6904
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
6905 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6906 * 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
6907 * 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
6908 * 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
6909 * 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
6910 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6911 void dw_window_default(HWND window, HWND defaultitem)
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6912 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6913 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
6914 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
6915
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6916 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
6917 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
6918 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
6919
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6920 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
6921 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
6922 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6923
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6924 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6925 * 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
6926 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6927 * 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
6928 * 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
6929 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6930 void dw_window_click_default(HWND window, HWND next)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6931 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6932 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
6933
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
6934 if(blah)
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6935 blah->clickdefault = next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6936 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6937
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
6938 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6939 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6940 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6941 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6942 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6943 void dw_environment_query(DWEnv *env)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6944 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6945 ULONG Build;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6946
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6947 if(!env)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6948 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6949
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6950 /* The default is OS/2 2.0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6951 strcpy(env->osName,"OS/2");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6952 env->MajorVersion = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6953 env->MinorVersion = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6954
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6955 Build = _GetSystemBuildLevel();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6956 env->MinorBuild = Build & 0xFFFF;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6957 env->MajorBuild = Build >> 16;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6958
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6959 if (aulBuffer[0] == 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6960 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6961 int i = (unsigned int)aulBuffer[1];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6962 if (i > 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6963 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6964 strcpy(env->osName,"Warp");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6965 env->MajorVersion = (int)i/10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6966 env->MinorVersion = i-(((int)i/10)*10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6967 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6968 else if (i == 10)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6969 env->MinorVersion = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6970 }
15
81833f25b1aa Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 14
diff changeset
6971 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
6972 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
6973 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
6974 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
6975 env->DWSubVersion = DW_SUB_VERSION;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6976 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6977
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6978 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6979 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6980 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6981 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6982 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6983 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6984 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6985 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6986 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6987 * the file path on success.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6988 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6989 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6990 char *dw_file_browse(char *title, char *defpath, char *ext, int flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6991 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6992 FILEDLG fild;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6993 HWND hwndFile;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6994 int len;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6995
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6996 if(defpath)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6997 strcpy(fild.szFullFile, defpath);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6998 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6999 strcpy(fild.szFullFile, "");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7000
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7001 len = strlen(fild.szFullFile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7002
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7003 if(len)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7004 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7005 if(fild.szFullFile[len-1] != '\\')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7006 strcat(fild.szFullFile, "\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7007 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7008 strcat(fild.szFullFile, "*");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7009
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7010 if(ext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7011 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7012 strcat(fild.szFullFile, ".");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7013 strcat(fild.szFullFile, ext);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7014 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7015
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7016 fild.cbSize = sizeof(FILEDLG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7017 fild.fl = /*FDS_HELPBUTTON |*/ FDS_CENTER | FDS_OPEN_DIALOG;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7018 fild.pszTitle = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7019 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7020 fild.ulUser = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7021 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7022 fild.lReturn = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7023 fild.lSRC = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7024 fild.hMod = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7025 fild.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7026 fild.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7027 fild.pszIType = (PSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7028 fild.papszITypeList = (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7029 fild.pszIDrive = (PSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7030 fild.papszIDriveList= (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7031 fild.sEAType = (SHORT)0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7032 fild.papszFQFilename= (PAPSZ)NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7033 fild.ulFQFCount = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7034
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7035 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7036 if(hwndFile)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7037 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7038 switch(fild.lReturn)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7039 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7040 case DID_OK:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7041 return strdup(fild.szFullFile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7042 case DID_CANCEL:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7043 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7044 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7045 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7046 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7047 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7048
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7049 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7050 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7051 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7052 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7053 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7054 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7055 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7056 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7057 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7058 int dw_exec(char *program, int type, char **params)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7059 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7060 return spawnvp(P_NOWAIT, program, (const char **)params);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7061 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7062
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7063 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7064 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7065 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7066 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7067 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7068 int dw_browse(char *url)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7069 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7070 /* Is there a way to find the webbrowser in Unix? */
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7071 char *execargs[3], browser[1024], *newurl = NULL;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7072 int len;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7073
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7074 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7075 "DefaultBrowserExe", NULL, browser, 1024);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7076
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7077 len = strlen(browser) - strlen("explore.exe");
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7078
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7079 execargs[0] = browser;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7080 execargs[1] = url;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7081 execargs[2] = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7082
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7083 /* 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
7084 * 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
7085 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7086 if(len > 0)
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7087 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7088 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
7089 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7090 int newlen, z;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7091 newurl = alloca(strlen(url) + 2);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7092 sprintf(newurl, "file:///%s", &url[7]);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7093 newlen = strlen(newurl);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7094 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
7095 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7096 if(newurl[z] == '|')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7097 newurl[z] = ':';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7098 if(newurl[z] == '/')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7099 newurl[z] = '\\';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7100 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7101 execargs[1] = newurl;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7102 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7103 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
7104
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7105 return dw_exec(browser, DW_EXEC_GUI, execargs);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7106 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7107
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7108 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7109 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7110 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7111 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7112 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7113 char *dw_user_dir(void)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7114 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7115 static char _user_dir[1024] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7116
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7117 if(!_user_dir[0])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7118 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7119 char *home = getenv("HOME");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7120
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7121 if(home)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7122 strcpy(_user_dir, home);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7123 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7124 strcpy(_user_dir, "C:\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7125 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7126 return _user_dir;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7127 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7128
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7129 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7130 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7131 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7132 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7133 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7134 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7135 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7136 void dw_window_function(HWND handle, void *function, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7137 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7138 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7139 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7140
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7141 /* 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
7142 * 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
7143 * 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
7144 */
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7145 UserData *find_userdata(UserData **root, char *varname)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7146 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7147 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
7148
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7149 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
7150 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7151 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
7152 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
7153 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
7154 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7155 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
7156 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7157
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7158 int new_userdata(UserData **root, char *varname, void *data)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7159 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7160 UserData *new = find_userdata(root, varname);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7161
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7162 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
7163 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7164 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
7165 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
7166 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7167 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7168 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7169 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
7170 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
7171 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7172 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
7173 new->data = data;
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7174
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7175 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
7176
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7177 if (!*root)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7178 *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
7179 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7180 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7181 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
7182 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
7183 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7184 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
7185 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
7186 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7187 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
7188 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
7189 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7190 *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
7191 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7192 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
7193 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7194 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7195 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
7196 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7197
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7198 int remove_userdata(UserData **root, char *varname, int all)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7199 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7200 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
7201
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7202 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
7203 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7204 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
7205 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7206 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
7207 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7208 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
7209 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
7210 *root = NULL;
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7211 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
7212 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7213 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7214 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7215 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
7216 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
7217 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
7218 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
7219 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7220 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7221 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
7222 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7223 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
7224 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7225
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7226 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7227 * 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
7228 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7229 * 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
7230 * 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
7231 * 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
7232 */
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7233 void dw_window_set_data(HWND window, char *dataname, void *data)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7234 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7235 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
7236
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7237 if(blah)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7238 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7239 if(data)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7240 new_userdata(&(blah->root), dataname, data);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7241 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7242 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7243 if(dataname)
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7244 remove_userdata(&(blah->root), dataname, FALSE);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7245 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7246 remove_userdata(&(blah->root), NULL, TRUE);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7247 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7248 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7249 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7250
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7251 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7252 * 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
7253 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7254 * 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
7255 * 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
7256 * 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
7257 */
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7258 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
7259 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7260 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
7261
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7262 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
7263 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7264 UserData *ud = find_userdata(&(blah->root), dataname);
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7265 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
7266 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
7267 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7268 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
7269 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
7270
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7271 #ifndef NO_SIGNALS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7272 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7273 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7274 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7275 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7276 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7277 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7278 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7279 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7280 void dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7281 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7282 ULONG message = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7283
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7284 if(strcmp(signame, "lose-focus") == 0)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7285 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7286 char tmpbuf[100];
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7287
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7288 WinQueryClassName(window, 99, tmpbuf);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7289
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7290 if(strncmp(tmpbuf, "#2", 3) == 0)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7291 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7292 HENUM henum = WinBeginEnumWindows(window);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7293 HWND child = WinGetNextWindow(henum);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7294 WinEndEnumWindows(henum);
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7295 if(child)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7296 window = child;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7297 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
7298 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7299 if(window && signame && sigfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7300 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7301 if((message = _findsigmessage(signame)) != 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7302 _new_signal(message, window, sigfunc, data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7303 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7304 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7305
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7306 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7307 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7308 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7309 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7310 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7311 void dw_signal_disconnect_by_name(HWND window, char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7312 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7313 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7314 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7315
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7316 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7317 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7318
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7319 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7320 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7321 if(tmp->window == window && tmp->message == message)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7322 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7323 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7324 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7325 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7326 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7327 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7328 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7329 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7330 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7331 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7332 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7333 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7334 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7335 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7336 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7337 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7338 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7339 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7340 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7341 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7342 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7343
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7344 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7345 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7346 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7347 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7348 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7349 void dw_signal_disconnect_by_window(HWND window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7350 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7351 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7352
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7353 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7354 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7355 if(tmp->window == window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7356 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7357 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7358 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7359 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7360 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7361 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7362 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7363 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7364 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7365 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7366 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7367 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7369 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7370 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7371 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7372 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7373 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7374 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7375 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7376 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7377
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7378 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7379 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7380 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7381 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7382 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7383 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7384 void dw_signal_disconnect_by_data(HWND window, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7385 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7386 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7387
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7388 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7389 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7390 if(tmp->window == window && tmp->data == data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7391 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7392 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7393 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7394 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7395 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7396 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7397 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7398 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7399 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7400 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7401 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7402 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7403 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7404 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7405 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7406 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7407 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7408 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7409 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7410 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7411 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7412 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7413
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7414 #ifdef TEST
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7415 HWND mainwindow,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7416 listbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7417 okbutton,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7418 cancelbutton,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7419 lbbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7420 stext,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7421 buttonbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7422 testwindow,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7423 testbox,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7424 testok,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7425 testcancel,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7426 testbox2,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7427 testok2,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7428 testcancel2,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7429 notebook;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7430 int count = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7431
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7432 #ifdef USE_FILTER
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7433 /* Do any handling you need in the filter function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7434 LONG testfilter(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7435 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7436 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7437 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7438 case WM_COMMAND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7439 switch (COMMANDMSG(&msg)->cmd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7440 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7441 case 1001L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7442 case 1002L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7443 dw_window_destroy(mainwindow);;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7444 count--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7445 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7446 case 1003L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7447 case 1004L:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7448 dw_window_destroy(testwindow);;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7449 count--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7450 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7451 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7452 if(!count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7453 exit(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7454 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7455 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7456 /* Return -1 to allow the default handlers to return. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7457 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7458 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7459 #else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7460 int test_callback(HWND window, void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7461 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7462 dw_window_destroy((HWND)data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7463 /* Return -1 to allow the default handlers to return. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7464 count--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7465 if(!count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7466 exit(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7467 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7468 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7469 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7470
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7471 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7472 * Let's demonstrate the functionality of this library. :)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7473 */
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 55
diff changeset
7474 int main(int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7475 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7476 ULONG flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7477 DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7478 int pageid;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7479
58
5c66a108aa47 Fixed example test app at the bottom of the source to use new dw_init
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 55
diff changeset
7480 dw_init(TRUE, argc, argv);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7481
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7482 /* Try a little server dialog. :) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7483 mainwindow = dw_window_new(HWND_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7484
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7485 lbbox = dw_box_new(BOXVERT, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7486
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7487 dw_box_pack_start(mainwindow, lbbox, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7488
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7489 stext = dw_text_new("Choose a server:", 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7490
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7491 dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7492
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7493 dw_box_pack_start(lbbox, stext, 130, 15, FALSE, FALSE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7494
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7495 listbox = dw_listbox_new(100L, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7496
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7497 dw_box_pack_start(lbbox, listbox, 130, 200, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7498
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7499 buttonbox = dw_box_new(BOXHORZ, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7500
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7501 dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7502
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7503 okbutton = dw_button_new("Ok", 1001L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7504
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7505 dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, TRUE, 5);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7506
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7507 cancelbutton = dw_button_new("Cancel", 1002L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7508
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7509 dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, TRUE, 5);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7510
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7511 /* Set some nice fonts and colors */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7512 dw_window_set_color(lbbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7513 dw_window_set_color(buttonbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7514 dw_window_set_font(stext, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7515 dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7516 dw_window_set_font(listbox, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7517 dw_window_set_font(okbutton, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7518 dw_window_set_font(cancelbutton, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7519
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7520 dw_window_show(mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7521
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7522 dw_window_set_usize(mainwindow, 170, 340);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7523
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7524 /* Another small example */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7525 flStyle |= FCF_MINMAX | FCF_SIZEBORDER;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7526
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7527 testwindow = dw_window_new(HWND_DESKTOP, "Wow a test dialog! :) yay!", flStyle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7528
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7529 testbox = dw_box_new(BOXVERT, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7530
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7531 dw_box_pack_start(testwindow, testbox, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7532
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7533 notebook = dw_notebook_new(1010L, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7534
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7535 dw_box_pack_start(testbox, notebook, 100, 100, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7536
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7537 testbox = dw_box_new(BOXVERT, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7538
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7539 pageid = dw_notebook_page_new(notebook, 0L, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7540
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7541 dw_notebook_page_set_text(notebook, pageid, "Test page");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7542 dw_notebook_page_set_status_text(notebook, pageid, "Test page");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7543
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7544 dw_notebook_pack(notebook, pageid, testbox);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7545
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7546 testok = dw_button_new("Ok", 1003L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7547
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7548 dw_box_pack_start(testbox, testok, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7549
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7550 testcancel = dw_button_new("Cancel", 1004L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7551
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7552 dw_box_pack_start(testbox, testcancel, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7553
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7554 testbox2 = dw_box_new(BOXHORZ, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7555
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7556 dw_box_pack_start(testbox, testbox2, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7557
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7558 testok2 = dw_button_new("Ok", 1003L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7559
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7560 dw_box_pack_start(testbox2, testok2, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7561
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7562 dw_box_pack_splitbar_start(testbox2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7563
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7564 testcancel2 = dw_button_new("Cancel", 1004L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7565
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7566 dw_box_pack_start(testbox2, testcancel2, 60, 40, TRUE, TRUE, 10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7567
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7568 /* Set some nice fonts and colors */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7569 dw_window_set_color(testbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7570 dw_window_set_color(testbox2, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7571 dw_window_set_font(testok, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7572 dw_window_set_font(testcancel, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7573 dw_window_set_font(testok2, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7574 dw_window_set_font(testcancel2, "9.WarpSans");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7575
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7576 dw_window_show(testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7577
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7578 #ifdef USE_FILTER
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7579 dw_main(0L, (void *)testfilter);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7580 #else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7581 /* Setup the function callbacks */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7582 dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7583 dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7584 dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7585 dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7586 dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7587 dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7588 dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7589 dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7590
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7591 dw_main(0L, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7592 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7593
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7594 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7595 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7596 #endif