annotate os2/dw.c @ 612:c5e5671dec8f

Modify Calendar widget Amke Mac port actually compile and run Add Clipboard support for GTK and Win Add *from_data() contructors allowing icons, bitmaps to be created from embedded data.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 23 Mar 2008 04:54:30 +0000
parents b4cb30f47a97
children f6f887d2c5aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
1 /*
3
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 *
516
caa7ed17c132 Updated copyrights and license file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 514
diff changeset
5 * (C) 2000-2004 Brian Smith <dbsoft@technologist.com>
612
c5e5671dec8f Modify Calendar widget
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 607
diff changeset
6 * (C) 2003-2008 Mark Hessling <m.hessling@qut.edu.au>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7 * (C) 2000 Achim Hasenmueller <achimha@innotek.de>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8 * (C) 2000 Peter Nielsen <peter@pmview.com>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9 * (C) 1998 Sergey I. Yevtushenko (some code borrowed from cell toolkit)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
12 #define INCL_DOS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
13 #define INCL_DOSERRORS
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
14 #define INCL_WIN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
15 #define INCL_GPI
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
16
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
17 #include <os2.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
18 #include <stdlib.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
19 #include <string.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
20 #include <stdio.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
21 #include <stdarg.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
22 #include <stddef.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
23 #include <ctype.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
24 #include <process.h>
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
25 #include <time.h>
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
26 #include <io.h>
171
b8e93557b2c7 EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 170
diff changeset
27 #ifndef __EMX__
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
28 #include <direct.h>
171
b8e93557b2c7 EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 170
diff changeset
29 #endif
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
30 #include <sys/time.h>
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
31 #include "dw.h"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
32
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
33 #define QWP_USER 0
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
34
554
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
35 /* The toolkit headers don't seem to have this */
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
36 BOOL APIENTRY WinStretchPointer(HPS hps, LONG x, LONG y, LONG cx, LONG cy, HPOINTER hptr, ULONG fs);
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
37
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
38 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
39 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
40 void _do_resize(Box *thisbox, int x, int y);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
41 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
42 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height);
438
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
43 void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname);
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
44 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname);
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
45 void _free_menu_data(HWND menu);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
46
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
47 char ClassName[] = "dynamicwindows";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
48 char SplitbarClassName[] = "dwsplitbar";
360
cf66410d03b4 Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 356
diff changeset
49 char *DefaultFont = "9.WarpSans";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
50
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
51 HAB dwhab = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
52 HMQ dwhmq = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
53 DWTID _dwtid = 0;
369
39983df2b93d Updated the license information, and copyrights. Code to do background
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 368
diff changeset
54 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
55
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
56 HWND hwndApp = NULLHANDLE, hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE;
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
57 PRECORDCORE pCoreEmph = NULL;
500
fe12a72bfddf Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 499
diff changeset
58 ULONG aulBuffer[4], GlobalID = 10000;
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
59 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop;
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
60 HMOD wpconfig = 0;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
61
224
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
62 unsigned long _colors[] = {
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
63 CLR_BLACK,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
64 CLR_DARKRED,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
65 CLR_DARKGREEN,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
66 CLR_BROWN,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
67 CLR_DARKBLUE,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
68 CLR_DARKPINK,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
69 CLR_DARKCYAN,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
70 CLR_PALEGRAY,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
71 CLR_DARKGRAY,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
72 CLR_RED,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
73 CLR_GREEN,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
74 CLR_YELLOW,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
75 CLR_BLUE,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
76 CLR_PINK,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
77 CLR_CYAN,
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
78 CLR_WHITE
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
79 };
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
80
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
81 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
82
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
83 #ifndef min
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
84 #define min(a, b) (((a < b) ? a : b))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
85 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
86
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
87 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
88 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
89 struct _sighandler *next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
90 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
91 HWND window;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
92 int id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
93 void *signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
94 void *data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
95
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
96 } SignalHandler;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
97
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
98 SignalHandler *Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
99
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
100 typedef struct
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
101 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
102 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
103 char name[30];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
104
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
105 } SignalList;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
106
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
107 /* List of signals and their equivilent OS/2 message */
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
108 #define SIGNALMAX 16
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
109
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
110 SignalList SignalTranslate[SIGNALMAX] = {
307
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
111 { WM_SIZE, DW_SIGNAL_CONFIGURE },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
112 { WM_CHAR, DW_SIGNAL_KEY_PRESS },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
113 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
114 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
115 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
116 { WM_CLOSE, DW_SIGNAL_DELETE },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
117 { WM_PAINT, DW_SIGNAL_EXPOSE },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
118 { WM_COMMAND, DW_SIGNAL_CLICKED },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
119 { CN_ENTER, DW_SIGNAL_ITEM_ENTER },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
120 { CN_CONTEXTMENU, DW_SIGNAL_ITEM_CONTEXT },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
121 { LN_SELECT, DW_SIGNAL_LIST_SELECT },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
122 { CN_EMPHASIS, DW_SIGNAL_ITEM_SELECT },
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
123 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS },
346
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
124 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED },
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
125 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE },
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
126 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
127 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
128
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
129 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
130 */
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
131 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
132 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
133 SignalHandler *new = malloc(sizeof(SignalHandler));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
134
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
135 new->message = message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
136 new->window = window;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
137 new->id = id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
138 new->signalfunction = signalfunction;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
139 new->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
140 new->next = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
141
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
142 if (!Root)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
143 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
144 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
145 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
146 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
147 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
148 {
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
149 if(tmp->message == message &&
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
150 tmp->window == window &&
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
151 tmp->id == id &&
68
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
152 tmp->signalfunction == signalfunction)
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
153 {
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
154 tmp->data = data;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
155 free(new);
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
156 return;
8d6100960adf Minor tab changes on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 67
diff changeset
157 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
158 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
159 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
160 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
161 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
162 prev->next = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
163 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
164 Root = new;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
165 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
166 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
167
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
168 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
169 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
170 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
171 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
172
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
173 for(z=0;z<SIGNALMAX;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
174 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
175 if(stricmp(signame, SignalTranslate[z].name) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
176 return SignalTranslate[z].message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
177 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
178 return 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
179 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
180
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
181 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
182 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
183 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
184 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
185 PVOID user;
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
186 HTREEITEM parent;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
187
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
188 } 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
189
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
190
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
191 int _null_key(HWND window, int key, void *data)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
192 {
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
193 window = window; /* keep compiler happy */
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
194 key = key; /* keep compiler happy */
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
195 data = data; /* keep compiler happy */
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
196 return TRUE;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
197 }
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
198
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
199 /* 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
200 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
201 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
202 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
203
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
204 /* Find the toplevel window */
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
205 while((box = WinQueryWindow(lastbox, QW_PARENT)) != desktop && box > 0)
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
206 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
207 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
208 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
209 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
210 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
211 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
212 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
213
300
4559a2fd2db2 Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 298
diff changeset
214
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
215 /* Returns height of specified window. */
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
216 int _get_height(HWND handle)
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
217 {
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
218 unsigned long height;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
219 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
220 return (int)height;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
221 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
222
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
223 /* Find the height of the frame a desktop style window is sitting on */
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
224 int _get_frame_height(HWND handle)
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
225 {
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
226 while(handle)
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
227 {
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
228 HWND client;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
229 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
230 {
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
231 return _get_height(WinQueryWindow(handle, QW_PARENT));
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
232 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
233 handle = WinQueryWindow(handle, QW_PARENT);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
234 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
235 return dw_screen_height();
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
236 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
237
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
238 /* A "safe" WinSendMsg() that tries multiple times in case the
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
239 * queue is blocked for one reason or another.
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
240 */
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
241 MRESULT _dw_send_msg(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, int failure)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
242 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
243 MRESULT res;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
244 int z = 0;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
245
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
246 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
247 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
248 z++;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
249 if(z > 5000000)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
250 return (MRESULT)failure;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
251 dw_main_sleep(1);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
252 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
253 return res;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
254 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
255
561
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
256 /* Used in the slider and percent classes internally */
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
257 unsigned int _dw_percent_get_range(HWND handle)
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
258 {
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
259 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0));
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
260 }
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
261
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
262 /* Return the entryfield child of a window */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
263 HWND _find_entryfield(HWND handle)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
264 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
265 HENUM henum;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
266 HWND child, entry = 0;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
267
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
268 henum = WinBeginEnumWindows(handle);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
269 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
270 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
271 char tmpbuf[100];
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
272
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
273 WinQueryClassName(child, 99, tmpbuf);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
274
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
275 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
276 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
277 entry = child;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
278 break;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
279 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
280 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
281 WinEndEnumWindows(henum);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
282 return entry;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
283 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
284
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
285 /* 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
286 * 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
287 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
288 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
289 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
290 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
291 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
292
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
293 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
294 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
295 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
296 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
297
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
298 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
299
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
300 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
301 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
302 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
303 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
304
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
305 _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
306 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
307 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
308 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
309 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
310
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
311 /* Free bitmap data associated with a window */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
312 void _free_bitmap(HWND handle)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
313 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
314 HBITMAP hbm = (HBITMAP)dw_window_get_data(handle, "_dw_bitmap");
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
315 HPS hps = (HPS)dw_window_get_data(handle, "_dw_hps");
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
316 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc");
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
317 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap");
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
318 HPIXMAP disable = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled");
548
0369176130af Destroy the icon HPOINTER when destroying bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 547
diff changeset
319 HPOINTER icon = (HPOINTER)dw_window_get_data(handle, "_dw_button_icon");
0369176130af Destroy the icon HPOINTER when destroying bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 547
diff changeset
320
0369176130af Destroy the icon HPOINTER when destroying bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 547
diff changeset
321 if(icon)
0369176130af Destroy the icon HPOINTER when destroying bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 547
diff changeset
322 WinDestroyPointer(icon);
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
323
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
324 if(pixmap)
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
325 dw_pixmap_destroy(pixmap);
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
326
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
327 if(disable)
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
328 dw_pixmap_destroy(disable);
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
329
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
330 if(hps)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
331 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
332 GpiSetBitmap(hps, NULLHANDLE);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
333 GpiAssociate(hps, NULLHANDLE);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
334 GpiDestroyPS(hps);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
335 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
336
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
337 if(hdc)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
338 DevCloseDC(hdc);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
339
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
340 if(hbm)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
341 GpiDeleteBitmap(hbm);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
342 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
343
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
344 /* This function removes any handlers on windows and frees
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
345 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
346 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
347 void _free_window_memory(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
348 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
349 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
350 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
351 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
352
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
353 dw_signal_disconnect_by_window(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
354
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
355 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
356 _free_menu_data(child);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
357
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
358 if((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
359 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
360 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
361
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
362 if(box)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
363 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
364 if(box->count && box->items)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
365 free(box->items);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
366
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
367 WinSetWindowPtr(child, QWP_USER, 0);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
368 free(box);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
369 }
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
370 }
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
371
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
372 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
373 {
169
b2211123274e Fixed a minor handl leak when destroying conboboxes... the listbox part
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 167
diff changeset
374 WindowData *wd = (WindowData *)ptr;
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
375 char tmpbuf[100];
235
69f2a59ec7d0 Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 230
diff changeset
376
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
377 WinQueryClassName(handle, 99, tmpbuf);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
378
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
379 if(strncmp(tmpbuf, "ColorSelectClass", 17)!=0)
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
380 {
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
381 /* If this window has an associate bitmap destroy it. */
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
382 _free_bitmap(handle);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
383
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
384 if(strncmp(tmpbuf, "#1", 3)==0 && !WinWindowFromID(handle, FID_CLIENT))
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
385 {
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
386 Box *box = (Box *)ptr;
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
387
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
388 if(box->count && box->items)
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
389 free(box->items);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
390 }
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
391 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
342
4029240b5e63 Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 337
diff changeset
392 {
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
393 void *data = dw_window_get_data(handle, "_dw_percent");
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
394
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
395 if(data)
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
396 free(data);
342
4029240b5e63 Fixed a leak of the container's column data when destroying container
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 337
diff changeset
397 }
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
398 else if(strncmp(tmpbuf, "#37", 4)==0)
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
399 {
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
400 dw_container_clear(handle, FALSE);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
401 if(wd && dw_window_get_data(handle, "_dw_container"))
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
402 {
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
403 void *oldflags = wd->data;
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
404
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
405 wd->data = NULL;
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
406 free(oldflags);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
407 }
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
408 }
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
409
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
410 if(wd->oldproc)
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
411 WinSubclassWindow(handle, wd->oldproc);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
412
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
413 dw_window_set_data(handle, NULL, NULL);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
414 WinSetWindowPtr(handle, QWP_USER, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
415 free(ptr);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
416 }
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
417 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
418
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
419 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
420 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
421 _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
422
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
423 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
424 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
425 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
426
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
427 void _free_menu_data(HWND menu)
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
428 {
470
6ccac112f1e5 Minor formatting changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 468
diff changeset
429 int i, count = (int)WinSendMsg(menu, MM_QUERYITEMCOUNT, 0, 0);
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
430
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
431 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
432 _free_window_memory(menu);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
433
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
434 for(i=0;i<count;i++)
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
435 {
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
436 SHORT menuid = (SHORT)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0);
470
6ccac112f1e5 Minor formatting changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 468
diff changeset
437 MENUITEM mi;
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
438
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
439 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi))
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
440 && mi.hwndSubMenu)
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
441 _free_menu_data(mi.hwndSubMenu);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
442 }
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
443 }
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
444
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
445 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
446 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
447 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
448 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
449 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
450 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
451
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
452 if(!handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
453 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
454
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
455 WinQueryClassName(handle, 99, tmpbuf);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
456
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
457 if(!WinIsWindowEnabled(handle) ||
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
458 (strncmp(tmpbuf, "ColorSelectClass", 17) && dw_window_get_data(handle, "_dw_disabled")))
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
459 return 0;
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
460
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
461 /* These are the window classes which can
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
462 * obtain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
463 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
464 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
465 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
466 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
467 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
468 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
469 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
470 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
471 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
472 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
473 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
474 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
475
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
476 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
477 {
538
5c1ee7f6e7ff More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 537
diff changeset
478 int z;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
479 static HWND lasthwnd, firsthwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
480 static int finish_searching;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
481
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
482 /* Start is 2 when we have cycled completely and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
483 * need to set the focus to the last widget we found
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
484 * that was valid.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
485 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
486 if(start == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
487 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
488 if(lasthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
489 WinSetFocus(HWND_DESKTOP, lasthwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
490 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
491 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
492
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
493 /* Start is 1 when we are entering the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
494 * for the first time, it is zero when entering
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
495 * the function recursively.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
496 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
497 if(start == 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
498 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
499 lasthwnd = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
500 finish_searching = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
501 firsthwnd = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
502 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
503
538
5c1ee7f6e7ff More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 537
diff changeset
504 for(z=box->count-1;z>-1;z--)
5c1ee7f6e7ff More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 537
diff changeset
505 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
506 if(box->items[z].type == TYPEBOX)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
507 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
508 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
509
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
510 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
511 return 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
512 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
513 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
514 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
515 if(box->items[z].hwnd == handle)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
516 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
517 if(lasthwnd == handle && firsthwnd)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
518 WinSetFocus(HWND_DESKTOP, firsthwnd);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
519 else if(lasthwnd == handle && !firsthwnd)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
520 finish_searching = 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
521 else
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
522 WinSetFocus(HWND_DESKTOP, lasthwnd);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
523
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
524 /* If we aren't looking for the last handle,
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
525 * return immediately.
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
526 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
527 if(!finish_searching)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
528 return 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
529 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
530 if(_validate_focus(box->items[z].hwnd))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
531 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
532 /* Start is 3 when we are looking for the
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
533 * first valid item in the layout.
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
534 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
535 if(start == 3)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
536 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
537 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
538 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
539 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
540 return 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
541 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
542 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
543
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
544 if(!firsthwnd)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
545 firsthwnd = box->items[z].hwnd;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
546
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
547 lasthwnd = box->items[z].hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
548 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
549 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
550 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
551 char tmpbuf[100] = "";
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
552
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
553 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
554 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
555 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
556 /* Then try the bottom or right box */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
557 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright");
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
558
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
559 if(mybox)
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
560 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
561 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
562
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
563 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
564 return 1;
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
565 }
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
566
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
567 /* Try the top or left box */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
568 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft");
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
569
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
570 if(mybox)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
571 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
572 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
573
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
574 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
575 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
576 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
577 }
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
578 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
579 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
580 Box *notebox;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
581 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
582 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 0);
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
583
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
584 if(page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
585 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
586 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
587
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
588 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
589 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
590 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
591 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
592 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
593 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
594 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
595 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
596 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
597
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
598 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
599 {
538
5c1ee7f6e7ff More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 537
diff changeset
600 int z;
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
601 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
602 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
603
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
604 /* 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
605 * 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
606 * 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
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 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
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(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
611 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
612 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
613 }
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 /* 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
616 * 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
617 * 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
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 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
620 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
621 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
622 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
623 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
624 }
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
538
5c1ee7f6e7ff More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 537
diff changeset
626 for(z=0;z<box->count;z++)
5c1ee7f6e7ff More merging with Windows, removed code to reverse tabbing for vertical
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 537
diff changeset
627 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
628 if(box->items[z].type == TYPEBOX)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
629 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
630 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
631
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
632 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
633 return 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
634 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
635 else
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
636 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
637 if(box->items[z].hwnd == handle)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
638 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
639 if(lasthwnd == handle && firsthwnd)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
640 WinSetFocus(HWND_DESKTOP, firsthwnd);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
641 else if(lasthwnd == handle && !firsthwnd)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
642 finish_searching = 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
643 else
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
644 WinSetFocus(HWND_DESKTOP, lasthwnd);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
645
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
646 /* If we aren't looking for the last handle,
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
647 * return immediately.
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
648 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
649 if(!finish_searching)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
650 return 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
651 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
652 if(_validate_focus(box->items[z].hwnd))
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
653 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
654 /* Start is 3 when we are looking for the
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
655 * first valid item in the layout.
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
656 */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
657 if(start == 3)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
658 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
659 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
660 {
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
661 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
662 return 1;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
663 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
664 }
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
665
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
666 if(!firsthwnd)
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
667 firsthwnd = box->items[z].hwnd;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
668
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
669 lasthwnd = box->items[z].hwnd;
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
670 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
671 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
672 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
673 char tmpbuf[100] = "";
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
674
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
675 WinQueryClassName(box->items[z].hwnd, 99, tmpbuf);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
676 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
677 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
678 /* Try the top or left box */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
679 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft");
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
680
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
681 if(mybox)
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
682 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
683 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
684
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
685 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
686 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
687 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
688
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
689 /* Then try the bottom or right box */
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
690 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright");
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
691
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
692 if(mybox)
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
693 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
694 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
695
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
696 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
697 return 1;
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
698 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
699 }
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
700 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
701 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
702 Box *notebox;
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
703 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
704 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 0);
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
705
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
706 if(page)
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
707 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
708 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
709
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
710 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem))
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
711 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
712 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
713 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
714 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
715 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
716 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
717 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
718 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
719
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
720 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
721 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
722 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
723 int _initial_focus(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
724 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
725 Box *thisbox = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
726 HWND box;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
727
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
728 box = WinWindowFromID(handle, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
729 if(box)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
730 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
731 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
732 return 1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
733
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
734 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
735 _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
736 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
737 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
738
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
739 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
740 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
741 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
742 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
743 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
744 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
745 HWND box, lastbox = _toplevel_window(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
746
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
747 box = WinWindowFromID(lastbox, FID_CLIENT);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
748 if(box)
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
749 thisbox = WinQueryWindowPtr(box, QWP_USER);
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
750 else
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
751 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
752
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
753 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
754 {
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
755 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
756 _focus_check_box(thisbox, handle, 2, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
757 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
758 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
759
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
760 /* 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
761 * 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
762 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
763 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
764 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
765 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
766 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
767
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
768 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
769 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
770 thisbox = WinQueryWindowPtr(box, QWP_USER);
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
771 else
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
772 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
773
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
774 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
775 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
776 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
777 _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
778 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
779 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
780
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
781 /* This function will recursively search a box and add up the total height of it */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
782 void _count_size(HWND box, int type, int *xsize, int *xorigsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
783 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
784 int size = 0, origsize = 0, z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
785 Box *tmp = WinQueryWindowPtr(box, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
786
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
787 if(!tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
788 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
789 *xsize = *xorigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
790 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
791 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
792
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
793 if(type == tmp->type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
794 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
795 /* If the box is going in the direction we want, then we
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
796 * return the entire sum of the items.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
797 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
798 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
799 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
800 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
801 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
802 int s, os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
803
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
804 _count_size(tmp->items[z].hwnd, type, &s, &os);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
805 size += s;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
806 origsize += os;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
807 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
808 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
809 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
810 size += (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
811 origsize += (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
812 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
813 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
814 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
815 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
816 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
817 /* If the box is not going in the direction we want, then we only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
818 * want to return the maximum value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
819 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
820 int tmpsize = 0, tmporigsize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
821
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
822 for(z=0;z<tmp->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
823 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
824 if(tmp->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
825 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
826 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
827 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
828 tmpsize = (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height);
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
829 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
830 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
831
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
832 if(tmpsize > size)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
833 size = tmpsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
834 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
835 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
836
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
837 *xsize = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
838 *xorigsize = origsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
839 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
840
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
841
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
842 /* Function: TrackRectangle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
843 * Abstract: Tracks given rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
844 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
845 * If rclBounds is NULL, then track rectangle on entire desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
846 * rclTrack is in window coorditates and will be mapped to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
847 * desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
848 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
849
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
850 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
851 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
852 TRACKINFO track;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
853 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
854
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
855 track.cxBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
856 track.cyBorder = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
857 track.cxGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
858 track.cyGrid = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
859 track.cxKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
860 track.cyKeyboard = 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
861
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
862 if(!rclTrack)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
863 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
864
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
865 if(rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
866 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
867 track.rclBoundary = *rclBounds;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
868 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
869 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
870 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
871 track.rclBoundary.yTop =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
872 track.rclBoundary.xRight = 3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
873 track.rclBoundary.yBottom =
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
874 track.rclBoundary.xLeft = -3000;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
875 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
876
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
877 track.rclTrack = *rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
878
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
879 WinMapWindowPoints(hwndBase,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
880 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
881 (PPOINTL)&track.rclTrack,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
882 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
883
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
884 track.ptlMinTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
885 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
886 track.ptlMinTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
887 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
888 track.ptlMaxTrackSize.x = track.rclTrack.xRight
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
889 - track.rclTrack.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
890 track.ptlMaxTrackSize.y = track.rclTrack.yTop
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
891 - track.rclTrack.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
892
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
893 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
894
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
895 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
896
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
897 if(rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
898 *rclTrack = track.rclTrack;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
899
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
900 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
901 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
902
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
903 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
904 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
905 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
906
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
907 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
908
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
909 /* 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
910 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
911 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
912 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
913 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
914
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
915 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
916 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
917 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
918 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
919
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
920 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
921 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
922 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
923 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
924
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
925 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
926 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
927 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
928 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
929
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
930 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
931
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
932 _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
933 }
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 128
diff changeset
934 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, (MPARAM)page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR));
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
935 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
936
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
937 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
938 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
939
192
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
940 /* Return the OS/2 color from the DW color */
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
941 unsigned long _internal_color(unsigned long color)
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
942 {
224
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
943 if(color < 16)
e6571c4e4d3b Use the same DW_CLR_* values on all platforms including OS/2... so I
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 220
diff changeset
944 return _colors[color];
192
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
945 return color;
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
946 }
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
947
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
948 unsigned long _os2_color(unsigned long color)
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
949 {
574
70c8a30c254f Fixed incorrect calling convention on the click default handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 571
diff changeset
950 return DW_RED_VALUE(color) << 16 | DW_GREEN_VALUE(color) << 8 | DW_BLUE_VALUE(color);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
951 }
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
952
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
953 BOOL _MySetWindowPos(HWND hwnd, HWND parent, HWND behind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl)
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
954 {
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
955 int height = _get_height(parent);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
956
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
957 return WinSetWindowPos(hwnd, behind, x, height - y - cy, cx, cy, fl);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
958 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
959
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
960 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
961 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
962 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
963 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
964 int pass, int *usedpadx, int *usedpady)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
965 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
966 int z, currentx = 0, currenty = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
967 int uymax = 0, uxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
968 int upymax = 0, upxmax = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
969 /* Used for the SIZEEXPAND */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
970 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
971 int nupx = *usedpadx, nupy = *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
972
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
973 (*usedx) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
974 (*usedy) += (thisbox->pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
975
416
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
976 if(thisbox->grouphwnd)
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
977 {
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
978 char *text = dw_window_get_text(thisbox->grouphwnd);
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
979
457
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
980 thisbox->grouppady = 0;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
981
416
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
982 if(text)
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
983 {
514
08d770271709 More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 513
diff changeset
984 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady);
416
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
985 dw_free(text);
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
986 }
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
987
457
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
988 if(thisbox->grouppady)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
989 thisbox->grouppady += 3;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
990 else
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
991 thisbox->grouppady = 6;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
992
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
993 thisbox->grouppadx = 6;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
994
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
995 (*usedx) += thisbox->grouppadx;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
996 (*usedpadx) += thisbox->grouppadx;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
997 (*usedy) += thisbox->grouppady;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
998 (*usedpady) += thisbox->grouppady;
416
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
999 }
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
1000
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1001 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1002 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1003 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1004 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1005 int initialx, initialy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1006 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1007
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1008 initialx = x - (*usedx);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1009 initialy = y - (*usedy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1010
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1011 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1012 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1013 int newx, newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1014 int nux = *usedx, nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1015 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1016
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1017 /* On the second pass we know how big the box needs to be and how
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1018 * much space we have, so we can calculate a ratio for the new box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1019 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1020 if(pass == 2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1021 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1022 int deep = *depth + 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1023
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1024 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1025
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1026 tmp->upx = upx - *usedpadx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1027 tmp->upy = upy - *usedpady;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1028
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1029 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1030 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1031
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1032 tmp->width = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1033 tmp->height = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1034
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1035 tmp->parentxratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1036 tmp->parentyratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1037
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1038 tmp->parentpad = tmp->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1039
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1040 /* Just in case */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1041 tmp->xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1042 tmp->yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1043
457
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1044 if(thisbox->type == DW_VERT)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1045 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1046 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppady;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1047
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1048 if((thisbox->items[z].width - tmppad)!=0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1049 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmppad))/((float)(thisbox->items[z].width-tmppad));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1050 }
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1051 else
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1052 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1053 if((thisbox->items[z].width-tmp->upx)!=0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1054 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1055 }
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1056 if(thisbox->type == DW_HORZ)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1057 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1058 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppadx;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1059
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1060 if((thisbox->items[z].height-tmppad)!=0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1061 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmppad))/((float)(thisbox->items[z].height-tmppad));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1062 }
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1063 else
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1064 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1065 if((thisbox->items[z].height-tmp->upy)!=0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1066 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1067 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1068
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1069 nux = *usedx; nuy = *usedy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1070 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1071 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1072
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1073 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1074
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1075 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1076
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1077 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1078
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1079 newx = x - nux;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1080 newy = y - nuy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1081
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1082 tmp->minwidth = thisbox->items[z].width = initialx - newx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1083 tmp->minheight = thisbox->items[z].height = initialy - newy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1084 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1085 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1086
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1087 if(pass > 1 && *depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1088 {
457
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1089 if(thisbox->type == DW_VERT)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1090 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1091 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppadx;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1092
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1093 if((thisbox->minwidth-tmppad) == 0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1094 thisbox->items[z].xratio = 1.0;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1095 else
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1096 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-tmppad))/((float)(thisbox->minwidth-tmppad));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1097 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1098 else
457
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1099 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1100 if(thisbox->minwidth-thisbox->upx == 0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1101 thisbox->items[z].xratio = 1.0;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1102 else
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1103 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1104 }
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1105
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1106 if(thisbox->type == DW_HORZ)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1107 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1108 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppady;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1109
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1110 if((thisbox->minheight-tmppad) == 0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1111 thisbox->items[z].yratio = 1.0;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1112 else
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1113 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-tmppad))/((float)(thisbox->minheight-tmppad));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1114 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1115 else
457
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1116 {
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1117 if(thisbox->minheight-thisbox->upy == 0)
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1118 thisbox->items[z].yratio = 1.0;
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1119 else
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1120 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy));
e6b00c3e5086 Merging layout engine fix from the windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 454
diff changeset
1121 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1122
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1123 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
1124 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1125 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
1126
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1127 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
1128 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1129 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
1130 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
1131 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
1132 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1133 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1134 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1135 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1136 thisbox->items[z].xratio = thisbox->xratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1137 thisbox->items[z].yratio = thisbox->yratio;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1138 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1139
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1140 if(thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1141 {
452
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1142 int itemwidth = thisbox->items[z].width + (thisbox->items[z].pad*2);
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1143
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1144 if(itemwidth > uxmax)
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1145 uxmax = itemwidth;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1146 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1147 {
452
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1148 if(itemwidth > upxmax)
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1149 upxmax = itemwidth;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1150 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1151 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1152 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1153 if(thisbox->items[z].pad*2 > upxmax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1154 upxmax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1155 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1156 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1157 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1158 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1159 if(thisbox->items[z].width == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1160 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1161 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1162 /* thisbox->items[z].width = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1163 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1164 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1165 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1166 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1167 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1168 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1169 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1170 (*usedpadx) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1171 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1172 }
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1173 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1174 {
452
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1175 int itemheight = thisbox->items[z].height + (thisbox->items[z].pad*2);
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1176
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1177 if(itemheight > uymax)
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1178 uymax = itemheight;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1179 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1180 {
452
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1181 if(itemheight > upymax)
cf00d6e2b3cc Optimizations to the layout engine on OS/2 and Windows, eliminated 3 MUL
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 448
diff changeset
1182 upymax = itemheight;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1183 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1184 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1185 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1186 if(thisbox->items[z].pad*2 > upymax)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1187 upymax = thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1188 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1189 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1190 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1191 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1192 if(thisbox->items[z].height == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1193 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1194 /* figure out how much space this item requires */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1195 /* thisbox->items[z].height = */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1196 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1197 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1198 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1199 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1200 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1201 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1202 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1203 (*usedpady) += thisbox->items[z].pad*2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1204 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1205 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1206 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1207
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1208 (*usedx) += uxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1209 (*usedy) += uymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1210 (*usedpadx) += upxmax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1211 (*usedpady) += upymax;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1212
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1213 currentx += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1214 currenty += thisbox->pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1215
416
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
1216 if(thisbox->grouphwnd)
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
1217 {
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
1218 currentx += 3;
537
a3b2e2244c18 Code merge with Windows, groupbox text height was being added on the wrong
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 536
diff changeset
1219 currenty += thisbox->grouppady - 3;
416
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
1220 }
a4197ddfc50d Changes to calculate groupbox border widths and take this into account
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 408
diff changeset
1221
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1222 /* The second pass is for expansion and actual placement. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1223 if(pass > 1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1224 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1225 /* Any SIZEEXPAND items should be set to uxmax/uymax */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1226 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1227 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1228 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1229 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2);
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1230 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1231 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1232 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1233 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1234 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1235 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1236
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1237 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1238 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1239 if(*depth > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1240 {
425
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1241 float calcval;
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1242
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1243 if(thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1244 {
425
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1245 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1246 if(calcval == 0.0)
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1247 tmp->xratio = thisbox->xratio;
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1248 else
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1249 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1250 tmp->width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1251 }
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1252 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1253 {
425
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1254 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1255 if(calcval == 0.0)
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1256 tmp->yratio = thisbox->yratio;
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1257 else
4fe2df53ec9f Division by zero fix in the layout engine.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 418
diff changeset
1258 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1259 tmp->height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1260 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1261 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1262
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1263 (*depth)++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1264
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1265 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1266
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1267 (*depth)--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1268
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1269 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1270 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1271 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1272
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1273 for(z=0;z<(thisbox->count);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1274 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1275 int height = thisbox->items[z].height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1276 int width = thisbox->items[z].width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1277 int pad = thisbox->items[z].pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1278 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
1279 int vectorx, vectory;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1280
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1281 /* When upxmax != pad*2 then ratios are incorrect. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1282 vectorx = (int)((width*thisbox->items[z].xratio)-width);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1283 vectory = (int)((height*thisbox->items[z].yratio)-height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1284
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1285 if(width > 0 && height > 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1286 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1287 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1288 /* This is a hack to fix rounding of the sizing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1289 if(*depth == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1290 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1291 vectorx++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1292 vectory++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1293 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1294
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1295 /* If this item isn't going to expand... reset the vectors to 0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1296 if(thisbox->items[z].vsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1297 vectory = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1298 if(thisbox->items[z].hsize != SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1299 vectorx = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1300
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1301 WinQueryClassName(handle, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1302
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
1303 if(strncmp(tmpbuf, "#2", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1304 {
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
1305 HWND frame = (HWND)dw_window_get_data(handle, "_dw_combo_box");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1306 /* Make the combobox big enough to drop down. :) */
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
1307 WinSetWindowPos(handle, HWND_TOP, 0, -100,
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
1308 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1309 _MySetWindowPos(frame, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
1310 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1311 }
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
1312 else if(strncmp(tmpbuf, "#6", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1313 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1314 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1315 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1316 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1317 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1318 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
1319 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1320 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1321 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
1322 _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
1323 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1324 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1325 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1326 /* Then try the bottom or right box */
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1327 float *percent = (float *)dw_window_get_data(handle, "_dw_percent");
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1328 int type = (int)dw_window_get_data(handle, "_dw_type");
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1329 int cx = width + vectorx;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1330 int cy = height + vectory;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1331
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1332 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1333 cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1334
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1335 if(cx > 0 && cy > 0 && percent)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1336 _handle_splitbar_resize(handle, *percent, type, cx, cy);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1337 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1338 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1339 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1340 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1341 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1342 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1343 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1344 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1345
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1346 if(boxinfo && boxinfo->grouphwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1347 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
1348 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1349
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1350 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1351
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1352 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1353
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1354 if(thisbox->type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1355 currentx += width + vectorx + (pad * 2);
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
1356 if(thisbox->type == DW_VERT)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1357 currenty += height + vectory + (pad * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1358 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1359 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1360 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1361 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1362 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1363
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1364 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1365 {
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
1366 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
1367 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1368 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1369 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1370 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1371
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1372 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1373
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1374 if(usedx-usedpadx == 0 || usedy-usedpady == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1375 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1376
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1377 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1378 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1379
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1380 usedx = usedy = usedpadx = usedpady = depth = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1382 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1383 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1384 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1385 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1386
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1387 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1388 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1389 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1390 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
1391 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
1392 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
1393
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1394 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
1395 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
1396 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
1397
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1398 if(thisbox && !thisbox->titlebar)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1399 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1400 switch(msg)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1401 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1402 case WM_QUERYTRACKINFO:
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1403 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1404 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
1405 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1406 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
1407 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
1408 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
1409 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
1410
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1411 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
1412
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1413 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
1414 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
1415
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1416 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
1417 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1418 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1419 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1420 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1421
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1422 if(blah && *blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1423 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1424 PFNWP myfunc = *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1425 return myfunc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1426 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1427
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1428 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1429 }
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1430
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1431 void _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
1432 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1433 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1434
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1435 ptl1.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1436 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
1437 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
1438 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1439 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1440 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1441
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1442 /* 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
1443 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
1444 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1445 POINTL ptl1, ptl2;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1446
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1447 ptl2.x = ptl1.x = rclPaint.xLeft;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1448 ptl1.y = rclPaint.yTop - 1;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1449 ptl2.y = rclPaint.yBottom;
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1450 GpiMove(hpsPaint, &ptl1);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1451 GpiLine(hpsPaint, &ptl2);
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1452 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1453
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1454 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
1455 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1456 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
1457
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1458 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
1459 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
1460 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
1461 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
1462 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
1463 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1464
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1465 /* 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
1466 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
1467 {
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1468 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
1469
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1470 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
1471 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
1472 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
1473 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
1474 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
1475 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1476
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1477 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1478 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
1479 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1480 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1481
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1482 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1483 return MPFROMSHORT(FALSE);
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
1484
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1485 if(blah && *blah)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1486 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1487 PFNWP myfunc = *blah;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1488
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1489 switch(msg)
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1490 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1491 case WM_PAINT:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1492 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1493 HPS hpsPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1494 RECTL rclPaint;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1495 char buf[1024];
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1496
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1497 hpsPaint = WinBeginPaint(hWnd, 0, 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1498 WinQueryWindowRect(hWnd, &rclPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1499 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1500
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1501 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
1502 _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
1503 _Left(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1504
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1505 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
1506 _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
1507 _Bottom(hpsPaint, rclPaint);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1508
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1509 WinQueryWindowText(hWnd, 1024, buf);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1510 rclPaint.xLeft += 3;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1511 rclPaint.xRight--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1512 rclPaint.yTop--;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1513 rclPaint.yBottom++;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1514
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1515 GpiSetColor(hpsPaint, CLR_BLACK);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1516 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
1517 WinEndPaint(hpsPaint);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1518
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1519 return (MRESULT)TRUE;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1520 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1521 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1522 return myfunc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1523 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1524
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1525 return WinDefWindowProc(hWnd, msg, mp1, mp2);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1526 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1527
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1528 /* This procedure handles pointer changes */
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1529 MRESULT EXPENTRY _textproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1530 {
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1531 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1532
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1533 if(msg == WM_MOUSEMOVE &&_wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1534 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1535
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1536 if(blah && *blah)
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1537 {
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1538 PFNWP myfunc = *blah;
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1539
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1540 return myfunc(hWnd, msg, mp1, mp2);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1541 }
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1542
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1543 return WinDefWindowProc(hWnd, msg, mp1, mp2);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1544 }
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1545
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1546 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
1547 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1548 char tmpbuf[100];
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1549
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1550 WinQueryClassName(handle, 99, tmpbuf);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1551
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1552 /* 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
1553 * obtain input focus.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1554 */
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1555 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
1556 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1557 /* 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
1558 SignalHandler *tmp = Root;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1559
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1560 /* 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
1561 while(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1562 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1563 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
1564 {
574
70c8a30c254f Fixed incorrect calling convention on the click default handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 571
diff changeset
1565 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1566
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1567 /* 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
1568 if(tmp->window == handle)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1569 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1570 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
1571 tmp = NULL;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1572 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1573 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1574 if(tmp)
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1575 tmp= tmp->next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1576 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1577 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1578 else
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1579 WinSetFocus(HWND_DESKTOP, handle);
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1580 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1581
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1582 #define ENTRY_CUT 1001
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1583 #define ENTRY_COPY 1002
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1584 #define ENTRY_PASTE 1003
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1585 #define ENTRY_UNDO 1004
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1586 #define ENTRY_SALL 1005
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1587
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1588 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1589 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1590 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1591 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1592 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1593 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
1594 PFNWP oldproc = 0;
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1595 char tmpbuf[100];
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1596
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1597 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1598 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1599
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1600 WinQueryClassName(hWnd, 99, tmpbuf);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1601
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1602 /* These are the window classes which should get a menu */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1603 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1604 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1605 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1606 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1607 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1608 switch(msg)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1609 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1610 case WM_CONTEXTMENU:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1611 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1612 HMENUI hwndMenu = dw_menu_new(0L);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1613 long x, y;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1614
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1615 if(strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0))
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1616 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1617 dw_menu_append_item(hwndMenu, "Undo", ENTRY_UNDO, 0L, TRUE, FALSE, 0L);
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1618 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1619 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1620 dw_menu_append_item(hwndMenu, "Copy", ENTRY_COPY, 0L, TRUE, FALSE, 0L);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1621 if((strncmp(tmpbuf, "#10", 4)!=0 && !dw_window_get_data(hWnd, "_dw_disabled")) || (strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0)))
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1622 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1623 dw_menu_append_item(hwndMenu, "Cut", ENTRY_CUT, 0L, TRUE, FALSE, 0L);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1624 dw_menu_append_item(hwndMenu, "Paste", ENTRY_PASTE, 0L, TRUE, FALSE, 0L);
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1625 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1626 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, FALSE, 0L);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1627 dw_menu_append_item(hwndMenu, "Select All", ENTRY_SALL, 0L, TRUE, FALSE, 0L);
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1628
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1629 WinSetFocus(HWND_DESKTOP, hWnd);
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1630 dw_pointer_query_pos(&x, &y);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1631 dw_menu_popup(&hwndMenu, hWnd, x, y);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1632 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1633 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1634 case WM_COMMAND:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1635 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1636 ULONG command = COMMANDMSG(&msg)->cmd;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1637
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1638 /* MLE */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1639 if(strncmp(tmpbuf, "#10", 4)==0)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1640 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1641 switch(command)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1642 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1643 case ENTRY_CUT:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1644 return WinSendMsg(hWnd, MLM_CUT, 0, 0);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1645 case ENTRY_COPY:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1646 return WinSendMsg(hWnd, MLM_COPY, 0, 0);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1647 case ENTRY_PASTE:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1648 return WinSendMsg(hWnd, MLM_PASTE, 0, 0);
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1649 case ENTRY_UNDO:
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1650 return WinSendMsg(hWnd, MLM_UNDO, 0, 0);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1651 case ENTRY_SALL:
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1652 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1653 ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1654 return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1655 }
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1656 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1657 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1658 else /* Other */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1659 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1660 HWND handle = hWnd;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1661
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1662 /* Get the entryfield handle from multi window controls */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1663 if(strncmp(tmpbuf, "#2", 3)==0)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1664 handle = WinWindowFromID(hWnd, 667);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1665
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1666 if(handle)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1667 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1668 switch(command)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1669 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1670 case ENTRY_CUT:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1671 return WinSendMsg(handle, EM_CUT, 0, 0);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1672 case ENTRY_COPY:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1673 return WinSendMsg(handle, EM_COPY, 0, 0);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1674 case ENTRY_PASTE:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1675 return WinSendMsg(handle, EM_PASTE, 0, 0);
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1676 case ENTRY_SALL:
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1677 {
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1678 LONG len = WinQueryWindowTextLength(hWnd);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1679 return WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT(0, (SHORT)len), 0);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1680 }
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1681 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1682 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1683 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1684 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1685 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1686 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1687 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1688
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1689 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1690 {
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1691 case WM_BUTTON1DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1692 case WM_BUTTON2DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1693 case WM_BUTTON3DOWN:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1694 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1695 if(strncmp(tmpbuf, "#32", 4)==0)
38
538db2a48bac Added typecast to MPARAM.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 37
diff changeset
1696 _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
1697 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1698 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
1699 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
1700 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1701 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
1702 _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
1703 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
1704 break;
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1705 case WM_SETFOCUS:
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1706 _run_event(hWnd, msg, mp1, mp2);
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
1707 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1708 case WM_CHAR:
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1709 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1710 return (MRESULT)TRUE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1711 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1712 {
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
1713 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
1714 _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
1715 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
1716 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1717 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1718 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1719 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
1720 _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
1721 /* 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
1722 * 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
1723 */
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1724 else if(SHORT1FROMMP(mp2) == 283)
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 128
diff changeset
1725 return (MRESULT)TRUE;
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1726
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1727 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1728 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
1729 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1730 /* 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
1731 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
1732 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
1733 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1734 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1735 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
1736 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1737 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
1738 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
1739 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1740 break;
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
1741 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1742 if(_wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1743 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1744 break;
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1745 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1746
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1747 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
1748 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
1749
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1750 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
1751 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1752
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1753 /* Deal with combobox specifics and enhancements */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1754 MRESULT EXPENTRY _comboentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1755 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1756 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1757
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1758 switch(msg)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1759 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
1760 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1761 if(_wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1762 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1763 break;
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1764 case WM_CONTEXTMENU:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1765 case WM_COMMAND:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1766 return _entryproc(hWnd, msg, mp1, mp2);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1767 case WM_SETFOCUS:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1768 _run_event(hWnd, msg, mp1, mp2);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1769 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1770 case WM_CHAR:
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1771 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
1772 return (MRESULT)TRUE;
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1773 /* A Similar problem to the MLE, if ESC just return */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1774 if(SHORT1FROMMP(mp2) == 283)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1775 return (MRESULT)TRUE;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1776 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1777 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1778
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1779 if(blah && blah->oldproc)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1780 return blah->oldproc(hWnd, msg, mp1, mp2);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1781
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1782 return WinDefWindowProc(hWnd, msg, mp1, mp2);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1783 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1784
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1785 /* Enhance the standard OS/2 MLE control */
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1786 MRESULT EXPENTRY _mleproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1787 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1788 switch(msg)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1789 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1790 case WM_VSCROLL:
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1791 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK)
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1792 {
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1793 USHORT pos = SHORT1FROMMP(mp2);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1794
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
1795 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1796 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1797 break;
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1798 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1799 return _entryproc(hWnd, msg, mp1, mp2);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1800 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
1801
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1802 /* Handle special messages for the spinbutton's entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1803 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1804 {
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1805 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1806 PFNWP oldproc = 0;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1807
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1808 if(blah)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1809 oldproc = blah->oldproc;
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1810
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1811 switch(msg)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1812 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
1813 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1814 if(_wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1815 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1816 break;
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1817 case WM_CONTEXTMENU:
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1818 case WM_COMMAND:
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1819 return _entryproc(hWnd, msg, mp1, mp2);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1820 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1821
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1822 if(oldproc)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1823 return oldproc(hWnd, msg, mp1, mp2);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1824
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1825 return WinDefWindowProc(hWnd, msg, mp1, mp2);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1826 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
1827
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1828 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
1829 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1830 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value");
561
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
1831 int range = _dw_percent_get_range(hwnd);
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1832 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
1833 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
1834 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
1835 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
1836 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1837
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1838 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
1839 {
561
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
1840 int inew, range = _dw_percent_get_range(hwnd);
116
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1841 if(range)
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1842 {
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1843 float fpos = (float)pos;
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1844 float frange = (float)range;
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1845 float fnew = (fpos/frange)*1000.0;
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1846 inew = (int)fnew;
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1847 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew);
bb039d7407f0 Fix for floating point crash when trying to calculate new slider/percent
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 108
diff changeset
1848 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1849 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1850
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1851 /* 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
1852 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
1853 {
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1854 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
1855 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
1856
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1857 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
1858 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
1859
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1860 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
1861 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
1862 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1863 if(_wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1864 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1865 break;
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1866 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
1867 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
1868 break;
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1869 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
1870 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1871 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1872 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1873
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1874 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1875 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1876
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1877 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1878 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1879
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1880 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1881 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1882 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1883 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1884 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1885 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
1886 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
1887
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1888 if(blah)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1889 oldproc = blah->oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1890
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1891 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1892 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
1893 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1894 if(_wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1895 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1896 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1897 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1898 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1899 {
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
1900 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
1901 _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
1902 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
1903 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1904 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1905 }
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
1906 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
1907 _click_default(blah->clickdefault);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1908 break;
160
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1909 case WM_BUTTON1DBLCLK:
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1910 case WM_BUTTON2DBLCLK:
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1911 case WM_BUTTON3DBLCLK:
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1912 if(dw_window_get_data(hWnd, "_dw_disabled"))
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1913 return (MRESULT)TRUE;
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1914 break;
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1915 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
1916 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
1917 case WM_BUTTON3DOWN:
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
1918 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
160
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
1919 return (MRESULT)TRUE;
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1920 _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
1921 break;
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
1922 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
1923 _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
1924 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1925 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1926 {
406
765ec42ee2e4 Minor fix, we need to check the parent of the container widget instead of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 405
diff changeset
1927 HWND entry, frame = (HWND)dw_window_get_data(hWnd, "_dw_combo_box"), parent = WinQueryWindow(frame, QW_PARENT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1928 HPS hpsPaint;
404
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1929 POINTL ptl;
377
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1930 unsigned long width, height, thumbheight = 0;
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1931 ULONG color;
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1932
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1933 if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE)
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1934 dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight);
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1935
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1936 if(!thumbheight)
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1937 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1938
404
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1939 /* Add 6 because it has a thick border like the entryfield */
377
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1940 thumbheight += 6;
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1941
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1942 color = (ULONG)dw_window_get_data(parent, "_dw_fore");
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
1943 dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1944
404
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1945 if(height > thumbheight)
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1946 {
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1947 hpsPaint = WinGetPS(hWnd);
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1948 if(color)
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1949 GpiSetColor(hpsPaint, _internal_color(color-1));
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1950 else
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1951 GpiSetColor(hpsPaint, CLR_PALEGRAY);
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1952
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1953 ptl.x = ptl.y = 0;
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1954 GpiMove(hpsPaint, &ptl);
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1955
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1956 ptl.x = width;
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1957 ptl.y = height - thumbheight;
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1958 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1959
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1960 WinReleasePS(hpsPaint);
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
1961 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1962 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1963 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1964 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1965 if(oldproc)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
1966 return oldproc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1967
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1968 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1969 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1970
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1971 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1972 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1973 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1974 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1975 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1976
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1977 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1978 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1979 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1980 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1981 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1982 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1983 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1984
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1985 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1986 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1987 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1988 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1989 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1990
212
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1991 int _HandleScroller(HWND handle, int pos, int which)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1992 {
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1993 MPARAM res;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1994 int min, max, page;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1995
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1996 if(which == SB_SLIDERTRACK)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1997 return pos;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
1998
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
1999 pos = dw_scrollbar_get_pos(handle);
212
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2000 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2001
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2002 min = SHORT1FROMMP(res);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2003 max = SHORT2FROMMP(res);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2004 page = (int)dw_window_get_data(handle, "_dw_scrollbar_visible");
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2005
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2006 switch(which)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2007 {
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2008 case SB_LINEUP:
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2009 pos = pos - 1;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2010 if(pos < min)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2011 pos = min;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2012 dw_scrollbar_set_pos(handle, pos);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2013 return pos;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2014 case SB_LINEDOWN:
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2015 pos = pos + 1;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2016 if(pos > max)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2017 pos = max;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2018 dw_scrollbar_set_pos(handle, pos);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2019 return pos;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2020 case SB_PAGEUP:
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2021 pos = pos - page;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2022 if(pos < min)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2023 pos = min;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2024 dw_scrollbar_set_pos(handle, pos);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2025 return pos;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2026 case SB_PAGEDOWN:
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2027 pos = pos + page;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2028 if(pos > max)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2029 pos = max;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2030 dw_scrollbar_set_pos(handle, pos);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2031 return pos;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2032 }
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2033 return -1;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2034 }
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2035
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2036 void _clear_emphasis(void)
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2037 {
315
89eac0990c67 Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 314
diff changeset
2038 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph)
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2039 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE));
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2040 hwndEmph = NULLHANDLE;
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2041 pCoreEmph = NULL;
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2042 }
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2043
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2044 /* Find the desktop window handle */
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2045 HWND _menu_owner(HWND handle)
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2046 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2047 HWND menuowner = NULLHANDLE, lastowner = (HWND)dw_window_get_data(handle, "_dw_owner");
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2048 int menubar = (int)dw_window_get_data(handle, "_dw_menubar");
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2049
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2050 /* Find the toplevel window */
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2051 while(!menubar && (menuowner = (HWND)dw_window_get_data(lastowner, "_dw_owner")) != NULLHANDLE)
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2052 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2053 menubar = (int)dw_window_get_data(lastowner, "_dw_menubar");
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2054 lastowner = menuowner;
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2055 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2056 if(menuowner && menubar)
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2057 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2058 HWND client = WinWindowFromID(menuowner, FID_CLIENT);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2059
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2060 return client ? client : menuowner;
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2061 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2062 return NULLHANDLE;
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2063 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2064
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2065 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2066 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2067 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2068 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2069 ULONG origmsg = msg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2070
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2071 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2072 msg = WM_BUTTON1DOWN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2073 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2074 msg = WM_BUTTON1UP;
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2075 if(msg == WM_VSCROLL || msg == WM_HSCROLL)
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2076 msg = WM_CONTROL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2077
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2078 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2079 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2080 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2081 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2082 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2083 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2084 {
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2085 case WM_SETFOCUS:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2086 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2087 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
2088 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2089 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2090
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2091 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
2092 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2093 result = setfocusfunc(tmp->window, tmp->data);
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2094 tmp = NULL;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2095 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2096 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2097 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
2098 break;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2099 case WM_TIMER:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2100 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2101 int (* API timerfunc)(void *) = (int (* API)(void *))tmp->signalfunction;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2102 if(tmp->id == (int)mp1)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2103 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2104 if(!timerfunc(tmp->data))
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2105 dw_timer_disconnect(tmp->id);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2106 tmp = NULL;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2107 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2108 result = 0;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2109 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
2110 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2111 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2112 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2113 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2114
276
dfbda83b7cad Eliminate configure event callbacks when either the width or height is 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 267
diff changeset
2115 if((hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) && SHORT1FROMMP(mp2) && SHORT2FROMMP(mp2))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2116 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2117 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2118 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2119 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2120 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2121 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2122 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2123 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2124 POINTS pts = (*((POINTS*)&mp1));
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2125 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2126
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2127 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2128 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
2129 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2130
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2131 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2132 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2133 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2134 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2135 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2136 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2137 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2138 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2139 case WM_BUTTON3DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2140 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2141 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2142 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2143
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2144 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
2145 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2146 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2147 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2148 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2149 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2150 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2151 POINTS pts = (*((POINTS*)&mp1));
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2152 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2153
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2154 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2155 {
24
d9e87e8bcf1d Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 23
diff changeset
2156 int button = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2157
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2158 switch(origmsg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2159 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2160 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2161 button = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2162 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2163 case WM_BUTTON2UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2164 button = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2165 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2166 case WM_BUTTON3UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2167 button = 3;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2168 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2169 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2170
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2171 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
2172 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2173 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2174 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2175 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2176 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2177 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2178 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2179
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2180 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2181 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2182 int keys = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2183 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2184
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2185 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2186 keys = DW_BUTTON1_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2187 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2188 keys |= DW_BUTTON2_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2189 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2190 keys |= DW_BUTTON3_MASK;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2191
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2192 result = motionfunc(tmp->window, x, _get_frame_height(tmp->window) - y, keys, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2193 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2194 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2195 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2196 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2197 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2198 {
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2199 int (* API keypressfunc)(HWND, char, int, int, void *) = (int (* API)(HWND, char, int, int, void *))tmp->signalfunction;
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2200
300
4559a2fd2db2 Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 298
diff changeset
2201 if((hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2202 {
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2203 int vk;
293
315812516608 Changes to the key press handling, if the character is zero check the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 290
diff changeset
2204 char ch = 0;
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2205
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2206 if(SHORT1FROMMP(mp1) & KC_CHAR)
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2207 ch = (char)SHORT1FROMMP(mp2);
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2208 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY)
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2209 vk = SHORT2FROMMP(mp2);
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2210 else
300
4559a2fd2db2 Keypress handler fixes, more need to be done, because I screwed up and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 298
diff changeset
2211 vk = SHORT1FROMMP(mp2) + 128;
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2212
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2213 /* This is a hack to fix shift presses showing
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2214 * up as tabs!
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2215 */
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2216 if(ch == '\t' && !(SHORT1FROMMP(mp1) & KC_CHAR))
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2217 {
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2218 ch = 0;
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2219 vk = VK_SHIFT;
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2220 }
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2221
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2222 result = keypressfunc(tmp->window, ch, vk,
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
2223 SHORT1FROMMP(mp1) & (KC_ALT | KC_SHIFT | KC_CTRL), tmp->data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2224 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2225 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2226 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2227 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2228 case WM_CLOSE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2229 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2230 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2231
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2232 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2233 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2234 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
2235 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
2236 result = FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2237 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2238 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2239 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2240 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2241 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2242 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2243 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2244 DWExpose exp;
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2245 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2246 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2247
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2248 if(hWnd == tmp->window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2249 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2250 int height = _get_height(hWnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2251
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2252 hps = WinBeginPaint(hWnd, 0L, &rc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2253 exp.x = rc.xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2254 exp.y = height - rc.yTop - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2255 exp.width = rc.xRight - rc. xLeft;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2256 exp.height = rc.yTop - rc.yBottom;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2257 result = exposefunc(hWnd, &exp, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2258 WinEndPaint(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2259 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2260 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2261 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2262 case WM_COMMAND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2263 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2264 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2265 ULONG command = COMMANDMSG(&msg)->cmd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2266
466
c3dfa117b080 Added new code to make the menu handlers window local instead of global.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 465
diff changeset
2267 if(tmp->id && command == tmp->id)
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2268 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2269 HWND menuowner = _menu_owner(tmp->window);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2270
466
c3dfa117b080 Added new code to make the menu handlers window local instead of global.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 465
diff changeset
2271 if(menuowner == hWnd || menuowner == NULLHANDLE)
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2272 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2273 result = clickfunc(tmp->window, tmp->data);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2274 tmp = NULL;
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2275 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2276 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
2277 else if(tmp->window < 65536 && command == tmp->window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2278 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
2279 result = clickfunc(popup ? popup : tmp->window, tmp->data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2280 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2281 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2282 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2283 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2284 case WM_CONTROL:
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2285 if(origmsg == WM_VSCROLL || origmsg == WM_HSCROLL || tmp->message == SHORT2FROMMP(mp1) ||
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2286 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2287 {
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2288 int svar = SLN_SLIDERTRACK;
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2289 if(origmsg == WM_CONTROL)
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2290 svar = SHORT2FROMMP(mp1);
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2291
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2292 switch(svar)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2293 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2294 case CN_ENTER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2295 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2296 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2297 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2298 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2299 char *text = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2300
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2301 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2302 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2303 PRECORDCORE pre;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2304
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2305 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2306 if(pre)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2307 text = pre->pszIcon;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2308 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2309
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2310 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2311 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2312 result = containerselectfunc(tmp->window, text, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2313 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2314 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2315 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2316 break;
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2317 case CN_EXPANDTREE:
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2318 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2319 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))tmp->signalfunction;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2320 int id = SHORT1FROMMP(mp1);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2321 HWND conthwnd = dw_window_from_id(hWnd, id);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2322
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2323 if(tmp->window == conthwnd)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2324 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2325 result = treeexpandfunc(tmp->window, (HTREEITEM)mp2, tmp->data);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2326 tmp = NULL;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2327 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2328 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
2329 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2330 case CN_CONTEXTMENU:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2331 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2332 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2333 int id = SHORT1FROMMP(mp1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2334 HWND conthwnd = dw_window_from_id(hWnd, id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2335 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
2336 void *user = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2337 LONG x,y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2339 if(mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2340 {
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
2341 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
2342
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2343 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
2344
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2345 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
2346 user = pci->user;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2347 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2348
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2349 dw_pointer_query_pos(&x, &y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2350
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2351 if(tmp->window == conthwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2352 {
183
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2353 int container = (int)dw_window_get_data(tmp->window, "_dw_container");
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2354
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
2355 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
2356 {
183
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2357 if(!container)
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2358 {
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2359 NOTIFYRECORDEMPHASIS pre;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2360
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
2361 dw_tree_item_select(tmp->window, (HTREEITEM)mp2);
183
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2362 pre.pRecord = mp2;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2363 pre.fEmphasisMask = CRA_CURSORED;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2364 pre.hwndCnr = tmp->window;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2365 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre);
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2366 pre.pRecord->flRecordAttr |= CRA_CURSORED;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2367 }
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2368 else
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2369 {
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2370 if(pCoreEmph)
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2371 _clear_emphasis();
183
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2372 hwndEmph = tmp->window;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2373 pCoreEmph = mp2;
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2374 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE));
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2375 }
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
2376 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2377 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2378 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2379 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2381 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
2382 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
2383 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2384 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
2385 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
2386
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2387 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
2388 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2389 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
2390
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2391 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
2392 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2393 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
2394 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2395 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
2396
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2397 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
2398 {
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
2399 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction;
311
24c1dfffe97e Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 310
diff changeset
2400
161
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2401 if(dw_window_get_data(tmp->window, "_dw_container"))
311
24c1dfffe97e Unified the callback functions for tree and container widgets.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 310
diff changeset
2402 result = treeselectfunc(tmp->window, 0, pci->rc.pszIcon, tmp->data, 0);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2403 else
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2404 {
161
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2405 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2406 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2407 lasthcnr = 0;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2408 lastitem = 0;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2409 }
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2410 else
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2411 {
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2412 lasthcnr = tmp->window;
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2413 lastitem = (HWND)pci;
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
2414 result = treeselectfunc(tmp->window, (HTREEITEM)pci, pci->rc.pszIcon, tmp->data, pci->user);
161
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
2415 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2416 }
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
2417 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
2418 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2419 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2420 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2421 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
2422 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2423 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
2424 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2425 case LN_SELECT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2426 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2427 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
2428
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2429 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
2430
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2431 if(strncmp(classbuf, "#38", 4) == 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2432 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2433 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction;
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2434
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2435 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
2436 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2437 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
2438 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
2439 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
2440 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
2441 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2442 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
2443 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
2444 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
2445 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2446 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
2447 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2448 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2449 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2450 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2451 int (* API listboxselectfunc)(HWND, int, void *) = (int (* API )(HWND, int, void *))tmp->signalfunction;
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2452 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
2453 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
2454 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
2455
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2456 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2457 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2458 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
2459 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
2460
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
2461 dw_listbox_get_text(tmp->window, index, buf1, 500);
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2462
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2463 _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
2464
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2465 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
2466 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2467 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
2468
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2469 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
2470
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2471 /* 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
2472 * 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
2473 */
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2474 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
2475 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
2476
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2477 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
2478 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
2479 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2480 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2481 result = listboxselectfunc(tmp->window, index, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2482
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2483 _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
2484 tmp = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2485 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2486 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2487 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2488 break;
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2489 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
2490 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
2491 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction;
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2492
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2493 if(origmsg == WM_CONTROL)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2494 {
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2495 /* Handle Slider control */
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2496 if(tmp->window == hWnd || WinQueryWindow(tmp->window, QW_PARENT) == hWnd)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2497 {
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2498 static int lastvalue = -1;
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2499 static HWND lasthwnd = NULLHANDLE;
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2500 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0);
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2501 if(lastvalue != ulValue || lasthwnd != tmp->window)
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2502 {
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2503 dw_window_set_data(tmp->window, "_dw_slider_value", (void *)ulValue);
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2504 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2505 lastvalue = ulValue;
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2506 lasthwnd = tmp->window;
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2507 }
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2508 tmp = NULL;
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2509 }
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2510 }
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2511 else
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2512 {
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2513 /* Handle scrollbar control */
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2514 if(tmp->window > 65535 && tmp->window == WinWindowFromID(hWnd, (ULONG)mp1))
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2515 {
212
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2516 int pos = _HandleScroller(tmp->window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));;
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2517
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2518 if(pos > -1)
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2519 {
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2520 dw_window_set_data(tmp->window, "_dw_scrollbar_value", (void *)pos);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2521 result = valuechangedfunc(tmp->window, pos, tmp->data);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2522 }
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2523 result = 0;
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2524 tmp = NULL;
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
2525 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2526 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2527 }
346
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2528 break;
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2529 case BKN_PAGESELECTED:
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2530 {
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2531 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2532
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2533 if(psn && tmp->window == psn->hwndBook)
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2534 {
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2535 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))tmp->signalfunction;
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2536
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2537 result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data);
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2538 tmp = NULL;
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2539 }
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
2540 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2541 break;
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 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2545 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2546 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
2547
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2548 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2549 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2550
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2551 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2552 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2553 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2554
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2555 /* Gets a DW_RGB value from the three spinbuttons */
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2556 unsigned long _dw_color_spin_get(HWND window)
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2557 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2558 HWND button = (HWND)dw_window_get_data(window, "_dw_red_spin");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2559 long red, green, blue;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2560
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2561 red = dw_spinbutton_get_pos(button);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2562 button = (HWND)dw_window_get_data(window, "_dw_green_spin");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2563 green = dw_spinbutton_get_pos(button);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2564 button = (HWND)dw_window_get_data(window, "_dw_blue_spin");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2565 blue = dw_spinbutton_get_pos(button);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2566
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2567 return DW_RGB(red, green, blue);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2568 }
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2569
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2570 /* Set the three spinbuttons from a DW_RGB value */
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2571 void _dw_color_spin_set(HWND window, unsigned long value)
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2572 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2573 HWND button = (HWND)dw_window_get_data(window, "_dw_red_spin");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2574 dw_window_set_data(window, "_dw_updating", (void *)1);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2575 dw_spinbutton_set_pos(button, DW_RED_VALUE(value));
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2576 button = (HWND)dw_window_get_data(window, "_dw_green_spin");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2577 dw_spinbutton_set_pos(button, DW_GREEN_VALUE(value));
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2578 button = (HWND)dw_window_get_data(window, "_dw_blue_spin");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2579 dw_spinbutton_set_pos(button, DW_BLUE_VALUE(value));
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2580 dw_window_set_data(window, "_dw_updating", NULL);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2581 }
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2582
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2583 /* Sets the color selection control to be a DW_RGB value */
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2584 void _dw_col_set(HWND col, unsigned long value)
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2585 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2586 WinSendMsg(col, 0x0602, MPFROMLONG(_os2_color(value)), 0);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2587 if(!IS_WARP4())
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2588 WinSendMsg(col, 0x1384, MPFROMLONG(_os2_color(value)), 0);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2589 }
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2590
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2591 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2592 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2593 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2594 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2595
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2596 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2597 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2598 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2599 if(_wndproc(hWnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2600 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2601 break;
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2602 case WM_VSCROLL:
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
2603 case WM_HSCROLL:
212
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2604 if(_run_event(hWnd, msg, mp1, mp2))
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2605 {
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2606 HWND window = WinWindowFromID(hWnd, (ULONG)mp1);
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2607 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2608 }
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
2609 break;
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2610 /* Handles Color Selection control messages */
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2611 case 0x0601:
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2612 case 0x130C:
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2613 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2614 HWND window = (HWND)dw_window_get_data(hWnd, "_dw_window");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2615 unsigned long val = (unsigned long)mp1;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2616
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2617 if(window)
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2618 _dw_color_spin_set(window, DW_RGB((val & 0xFF0000) >> 16, (val & 0xFF00) >> 8, val & 0xFF));
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2619 }
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2620 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2621 case WM_CONTROL:
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2622 if((SHORT2FROMMP(mp1) == SPBN_CHANGE || SHORT2FROMMP(mp1) == SPBN_ENDSPIN))
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2623 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2624 HWND window = (HWND)dw_window_get_data(hWnd, "_dw_window");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2625
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2626 if(window && !dw_window_get_data(window, "_dw_updating"))
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2627 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2628 unsigned long val = _dw_color_spin_get(window);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2629 HWND col = (HWND)dw_window_get_data(window, "_dw_col");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2630
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2631 _dw_col_set(col, val);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2632 }
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
2633 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2634 _run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2635 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2636 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2637
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2638 if(blah && blah->oldproc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2639 return blah->oldproc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2640
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2641 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2642 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2643
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2644 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2645 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2646 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2647 int result = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2648 static int command_active = 0;
182
b8caec82a4d2 Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 180
diff changeset
2649 void (* API windowfunc)(PVOID) = 0L;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2650
150
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
2651 if(!command_active)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2652 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2653 /* Make sure we don't end up in infinite recursion */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2654 command_active = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2655
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2656 result = (int)_run_event(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2657
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2658 command_active = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2659 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2660
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2661 /* Now that any handlers are done... do normal processing */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2662 switch( msg )
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2663 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2664 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2665 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2666
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2667 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2668 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2669 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2670 RECTL rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2671
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2672 hps = WinBeginPaint( hWnd, 0L, &rc );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2673 WinEndPaint( hps );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2674 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2675 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2676
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2677 case WM_SIZE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2678 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2679 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2680
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2681 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2682 return (MPARAM)TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2683
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2684 if(mybox && mybox->flags != DW_MINIMIZED)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2685 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2686 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2687 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2688 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2689 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2690
536
81e29ea5dc2f Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 535
diff changeset
2691 if(mybox->items)
81e29ea5dc2f Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 535
diff changeset
2692 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE);
81e29ea5dc2f Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 535
diff changeset
2693
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2694 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2695
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2696 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2698 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2699 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2700 case WM_MINMAXFRAME:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2701 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2702 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2703 SWP *swp = (SWP *)mp1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2704
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2705 if(mybox && (swp->fl & SWP_MINIMIZE))
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2706 mybox->flags = DW_MINIMIZED;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2707
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2708 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
2709 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
2710 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
2711 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2712 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
2713 }
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2714
536
81e29ea5dc2f Almost have the new layout code fixed, just seeing a small problem with
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 535
diff changeset
2715 if(mybox && (swp->fl & (SWP_MAXIMIZE | SWP_RESTORE)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2716 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2717 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
2718 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
2719
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
2720 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
2721
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
2722 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
2723 return FALSE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2724
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2725 mybox->flags = 0;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
2726
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2727 /* Hide the window when recalculating to reduce
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2728 * CPU load.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2729 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2730 WinShowWindow(hWnd, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2732 _do_resize(mybox, swp->cx, swp->cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2733
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2734 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2735 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2736 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2737
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2738 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
2739 _check_resize_notebook(mybox->items[z].hwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2740
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2741 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2742
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2743 WinShowWindow(hWnd, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2744 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2745 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2746 break;
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2747 case WM_CONTROL:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2748 switch(SHORT2FROMMP(mp1))
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2749 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2750 case BKN_PAGESELECTEDPENDING:
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2751 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2752 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2753 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
2754 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
2755 unsigned long x, y, width, height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2756 RECTL rc;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2757
21
c6e76b796b28 Stopped unnecessary redrawing when switching to the same page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 20
diff changeset
2758 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
2759 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2760 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
2761
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2762 rc.xLeft = x;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2763 rc.yBottom = y;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2764 rc.xRight = x + width;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2765 rc.yTop = y + height;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2766
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2767 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
2768
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2769 _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
2770 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2771 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2772 break;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2773 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
2774 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2775 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
2776 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
2777 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2778 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
2779 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
2780 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2781 break;
404
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
2782 case WM_MOUSEMOVE:
720e61df8cf6 An even better combobox drawing fix. Only add 100 pixels to the size of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 399
diff changeset
2783 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2784 HPOINTER pointer;
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2785
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2786 if((pointer = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer")) ||
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2787 (pointer = (HPOINTER)dw_window_get_data(_toplevel_window(hWnd), "_dw_pointer")))
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2788 {
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2789 WinSetPointer(HWND_DESKTOP, pointer);
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
2790 return MRFROMSHORT(TRUE);
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2791 }
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2792 }
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
2793 return MRFROMSHORT(FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2794 case WM_USER:
182
b8caec82a4d2 Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 180
diff changeset
2795 windowfunc = (void (* API)(void *))mp1;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2796
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2797 if(windowfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2798 windowfunc((void *)mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2799 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2800 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2801 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2802 {
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
2803 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
2804 _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
2805 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
2806 _shift_focus(hWnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2807 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2808 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2809 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2810 case WM_DESTROY:
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2811 {
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2812 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2813
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2814 /* Free memory before destroying */
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2815 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd)
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2816 _free_window_memory(parent);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2817 else
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2818 _free_window_memory(hWnd);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
2819 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2820 break;
183
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2821 case WM_MENUEND:
498
00d0514cadc8 Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 497
diff changeset
2822 /* Delay removing the signal until we've executed
00d0514cadc8 Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 497
diff changeset
2823 * the signal handler.
00d0514cadc8 Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 497
diff changeset
2824 */
00d0514cadc8 Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 497
diff changeset
2825 WinPostMsg(hWnd, WM_USER+2, mp1, mp2);
00d0514cadc8 Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 497
diff changeset
2826 break;
00d0514cadc8 Fixes to the new popup menu code, removed a bogus check that was causing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 497
diff changeset
2827 case WM_USER+2:
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2828 _clear_emphasis();
499
b658d9628f41 Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 498
diff changeset
2829 if(dw_window_get_data((HWND)mp2, "_dw_popup"))
b658d9628f41 Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 498
diff changeset
2830 _free_menu_data((HWND)mp2);
183
b5a92b04b298 Minor change to handling of right clicks in the container control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 182
diff changeset
2831 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2832 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
2833
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
2834 if(result != -1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2835 return (MRESULT)result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2836 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2837 return WinDefWindowProc(hWnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2838 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2839
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2840 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2841 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2842 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2843
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2844 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2845 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2846 if(thisbox->items[z].type == TYPEBOX)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2847 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2848 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2849 _changebox(tmp, percent, type);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2850 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2851 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2852 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
2853 if(type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2854 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2855 if(thisbox->items[z].hsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2856 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2857 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2858 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2859 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2860 if(thisbox->items[z].vsize == SIZEEXPAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2861 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2862 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2863 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2864 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2865 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2866
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2867 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y)
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2868 {
539
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2869 float ratio = (float)percent/(float)100.0;
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2870 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2871 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2872 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2873
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2874 WinShowWindow(handle1, FALSE);
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2875 WinShowWindow(handle2, FALSE);
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2876
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
2877 if(type == DW_HORZ)
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2878 {
539
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2879 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2880
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2881 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE);
182
b8caec82a4d2 Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 180
diff changeset
2882 _do_resize(tmp, newx - 1, y - 1);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2883
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2884 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2885
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2886 tmp = WinQueryWindowPtr(handle2, QWP_USER);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2887
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2888 newx = x - newx - SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2889
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2890 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE);
182
b8caec82a4d2 Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 180
diff changeset
2891 _do_resize(tmp, newx - 1, y - 1);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2892 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2893 else
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2894 {
539
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2895 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2896
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2897 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE);
182
b8caec82a4d2 Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 180
diff changeset
2898 _do_resize(tmp, x - 1, newy - 1);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2899
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2900 tmp = WinQueryWindowPtr(handle2, QWP_USER);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2901
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2902 newy = y - newy - SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2903
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2904 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE);
182
b8caec82a4d2 Minor splitbar fixes on OS/2 and Windows. The splitbar width is now 4
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 180
diff changeset
2905 _do_resize(tmp, x - 1, newy - 1);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2906
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2907 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2908 }
539
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2909
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2910 WinShowWindow(handle1, TRUE);
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2911 WinShowWindow(handle2, TRUE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2912 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2913
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2914
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2915 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2916 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2917 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2918 switch (msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2919 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2920 case WM_ACTIVATE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2921 case WM_SETFOCUS:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2922 return (MRESULT)(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2923
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2924 case WM_PAINT:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2925 {
128
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2926 HPS hps;
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2927 POINTL ptl[2];
128
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2928 RECTL rcl;
539
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2929 int type = (int)dw_window_get_data(hwnd, "_dw_type");
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2930 int start = (int)dw_window_get_data(hwnd, "_dw_start");
128
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2931
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2932 hps = WinBeginPaint(hwnd, 0, 0);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2933
128
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2934 WinQueryWindowRect(hwnd, &rcl);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2935
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
2936 if(type == DW_HORZ)
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2937 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2938 ptl[0].x = rcl.xLeft + start;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2939 ptl[0].y = rcl.yBottom;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2940 ptl[1].x = rcl.xRight + start + 3;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2941 ptl[1].y = rcl.yTop;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2942 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2943 else
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2944 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2945 ptl[0].x = rcl.xLeft;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2946 ptl[0].y = rcl.yBottom + start;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2947 ptl[1].x = rcl.xRight;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2948 ptl[1].y = rcl.yTop + start + 3;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2949 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
2950
128
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2951
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2952 GpiSetColor(hps, CLR_PALEGRAY);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2953 GpiMove(hps, &ptl[0]);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2954 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
2955 WinEndPaint(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2956 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2957 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2958
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2959 case WM_MOUSEMOVE:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2960 {
539
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2961 int type = (int)dw_window_get_data(hwnd, "_dw_type");
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2962
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
2963 if(type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2964 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2965 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2966 SPTR_SIZEWE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2967 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2968 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2969 WinSetPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2970 WinQuerySysPointer(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2971 SPTR_SIZENS,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2972 FALSE));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2973 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2974 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2975 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2976 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2977 APIRET rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2978 RECTL rclFrame;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2979 RECTL rclBounds;
539
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2980 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2981 int type = (int)dw_window_get_data(hwnd, "_dw_type");
8f80ed604a89 Some splitbar optimizations, removed unneeded code and optimized crucial
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 538
diff changeset
2982 int start = (int)dw_window_get_data(hwnd, "_dw_start");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2983
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2984 WinQueryWindowRect(hwnd, &rclFrame);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2985 WinQueryWindowRect(hwnd, &rclBounds);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2986
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2987 WinMapWindowPoints(hwnd, HWND_DESKTOP,
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2988 (PPOINTL)&rclBounds, 2);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2989
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2990
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
2991 if(type == DW_HORZ)
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2992 {
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2993 rclFrame.xLeft = start;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2994 rclFrame.xRight = start + SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2995 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2996 else
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2997 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2998 rclFrame.yBottom = start;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
2999 rclFrame.yTop = start + SPLITBAR_WIDTH;
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3000 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3001
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3002 if(percent)
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3003 {
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3004 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3005
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3006 if(rc == TRUE)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3007 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3008 int width = (rclBounds.xRight - rclBounds.xLeft);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3009 int height = (rclBounds.yTop - rclBounds.yBottom);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3010
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
3011 if(type == DW_HORZ)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3012 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3013 start = rclFrame.xLeft - rclBounds.xLeft;
127
c5c3ccb84ac7 Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 125
diff changeset
3014 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
c5c3ccb84ac7 Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 125
diff changeset
3015 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3016 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3017 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3018 {
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3019 start = rclFrame.yBottom - rclBounds.yBottom;
127
c5c3ccb84ac7 Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 125
diff changeset
3020 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
c5c3ccb84ac7 Safety checks in the splitbar calculations on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 125
diff changeset
3021 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3022 }
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3023 _handle_splitbar_resize(hwnd, *percent, type, width, height);
541
f65fc3a049ff Move the fix, but it is just as ugly as before. ;)
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 540
diff changeset
3024 _handle_splitbar_resize(hwnd, *percent, type, width, height);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3025 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3026 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3027 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3028 return MRFROMSHORT(FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3029 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3030 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3031 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3032
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3033 /* Function: BubbleProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3034 * Abstract: Subclass procedure for bubble help
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3035 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3036 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3037 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3038 MRESULT res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3039 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3040
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3041 if(proc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3042 res = proc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3043 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3044 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3045
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3046 if(msg == WM_PAINT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3047 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3048 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3049 HPS hpsTemp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3050 RECTL rcl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3051 int height, width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3052
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3053 WinQueryWindowRect(hwnd, &rcl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3054 height = rcl.yTop - rcl.yBottom - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3055 width = rcl.xRight - rcl.xLeft - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3056
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3057 /* Draw a border around the bubble help */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3058 hpsTemp = WinGetPS(hwnd);
230
15810221d4ea Don't use DW_CLR_* when making direct OS/2 API calls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 228
diff changeset
3059 GpiSetColor(hpsTemp, CLR_BLACK);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3060 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3061 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3062 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3063 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3064 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3065 ptl.x = ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3066 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3067 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3068 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3069 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3070 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3071 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3072 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3073 ptl.x = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3074 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3075 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3076 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3077 ptl.y = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3078 GpiMove(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3079 ptl.y = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3080 ptl.x = width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3081 GpiLine(hpsTemp, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3082 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3083 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3084 return res;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3085 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3086
366
4ed3b13ee48c Code to do the OS/2 style indent when the button is pressed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 365
diff changeset
3087 MRESULT EXPENTRY _button_draw(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, PFNWP oldproc, int indent)
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3088 {
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3089 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap");
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3090 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled");
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3091 HPOINTER icon = (HPOINTER)dw_window_get_data(hwnd, "_dw_button_icon");
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3092 MRESULT res;
547
291f3eae2c25 Use 16x16 mini icon, and added code to draw the depressed button when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 546
diff changeset
3093 unsigned long width, height;
554
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3094 int x = 5, y = 5;
547
291f3eae2c25 Use 16x16 mini icon, and added code to draw the depressed button when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 546
diff changeset
3095
291f3eae2c25 Use 16x16 mini icon, and added code to draw the depressed button when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 546
diff changeset
3096 dw_window_get_pos_size(hwnd, NULL, NULL, &width, &height);
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3097
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3098 if(!oldproc)
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3099 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3100 res = oldproc(hwnd, msg, mp1, mp2);
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3101
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3102 if(icon)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3103 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3104 ULONG halftone = DP_NORMAL;
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3105 HPS hps = WinGetPS(hwnd);
554
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3106 POINTERINFO pi;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3107 int cx, cy;
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3108
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3109 if(dw_window_get_data(hwnd, "_dw_disabled"))
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3110 halftone = DP_HALFTONED;
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3111
554
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3112 cx = width - 10;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3113 cy = height - 10;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3114
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3115 if(WinQueryPointerInfo(icon, &pi))
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3116 {
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3117 BITMAPINFOHEADER sl;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3118 int newcx = cx, newcy = cy;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3119
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3120 /* Check the mini icon first */
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3121 if(GpiQueryBitmapParameters(pi.hbmMiniColor, &sl))
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3122 {
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3123 if(sl.cx && sl.cy && cx > sl.cx && cy > sl.cy)
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3124 {
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3125 newcx = sl.cx;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3126 newcy = sl.cy;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3127 }
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3128 }
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3129 /* Check the normal icon second */
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3130 if(GpiQueryBitmapParameters(pi.hbmColor, &sl))
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3131 {
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3132 if(sl.cx && sl.cy && cx > sl.cx && cy > sl.cy)
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3133 {
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3134 newcx = sl.cx;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3135 newcy = sl.cy;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3136 }
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3137 }
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3138 cx = newcx; cy = newcy;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3139 x = (width - cx)/2;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3140 y = (height - cy)/2;
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3141 }
6707adaa093d Added some more intellegent code to determine the best icon size when using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 553
diff changeset
3142 WinStretchPointer(hps, x + indent, y - indent, cx, cy, icon, halftone);
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3143 WinReleasePS(hps);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3144 }
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
3145 else if(pixmap)
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3146 {
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3147 x = (width - pixmap->width)/2;
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3148 y = (height - pixmap->height)/2;
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3149
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3150 if(disable && dw_window_get_data(hwnd, "_dw_disabled"))
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3151 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, disable, 0, 0);
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3152 else
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3153 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, pixmap, 0, 0);
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3154 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3155 return res;
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3156 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3157
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3158 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3159 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3160 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3161
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3162 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3163 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3164 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
3165 PFNWP oldproc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3166
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3167 bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3168
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3169 if(!bubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3170 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3171
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
3172 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
3173
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3174 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3175 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
3176 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3177 if(_wndproc(hwnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3178 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3179 break;
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3180 case WM_PAINT:
366
4ed3b13ee48c Code to do the OS/2 style indent when the button is pressed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 365
diff changeset
3181 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0);
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3182 case BM_SETHILITE:
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3183 return _button_draw(hwnd, msg, mp1, mp2, oldproc, (int)mp1);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3184 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
3185 if(mp2)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3186 _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
3187 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3188 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3189 break;
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3190 case WM_BUTTON1DOWN:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3191 case WM_BUTTON2DOWN:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3192 case WM_BUTTON3DOWN:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3193 case WM_BUTTON1DBLCLK:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3194 case WM_BUTTON2DBLCLK:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3195 case WM_BUTTON3DBLCLK:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3196 if(dw_window_get_data(hwnd, "_dw_disabled"))
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3197 return (MRESULT)FALSE;
368
72fbd1ee8150 Ug, missed a break statement.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 367
diff changeset
3198 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3199 case WM_BUTTON1UP:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3200 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3201 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3202
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3203 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled"))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3204 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3205 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3206 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3207 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3208 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3209 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3210 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3211 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3212 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3213 /* Due to the fact that if we run the function
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3214 * here, finishing actions on the button will occur
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3215 * after we run the signal handler. So we post the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3216 * message so the button can finish what it needs to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3217 * do before we run our handler.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3218 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3219 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3220 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3221 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3222 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3223 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3224 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3225 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3226 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3227 }
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
3228 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3229 case WM_USER:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3230 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3231 SignalHandler *tmp = (SignalHandler *)mp1;
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
3232 int (* API clickfunc)(HWND, void *) = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3233
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3234 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3235 {
175
d78d08440246 Use _System/_stdcall for callbacks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 174
diff changeset
3236 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3237
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3238 clickfunc(tmp->window, tmp->data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3239 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3240 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3241 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3242 case WM_CHAR:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3243 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3244 /* A button press should also occur for an ENTER or SPACE press
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3245 * while the button has the active input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3246 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3247 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3248 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3249 SignalHandler *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3250
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3251 /* Find any callbacks for this function */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3252 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3253 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3254 if(tmp->message == WM_COMMAND)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3255 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3256 /* Make sure it's the right window, and the right ID */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3257 if(tmp->window == hwnd)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3258 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3259 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3260 tmp = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3261 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3262 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3263 if(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3264 tmp= tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3265 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3266 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3267 if(SHORT1FROMMP(mp2) == '\t')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3268 {
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
3269 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
3270 _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
3271 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
3272 _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
3273 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
3274 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
3275 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
3276 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
3277 {
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
3278 _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
3279 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
3280 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
3281 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
3282 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3283 _shift_focus(hwnd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3284 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3285 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3286 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3287 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3288 case 0x041f:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3289 if (hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3290 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3291 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3292 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3293 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3294 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3295
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3296 case 0x041e:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3297
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3298 if(!*bubble->bubbletext)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3299 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3300
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3301 if(hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3302 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3303 WinDestroyWindow(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3304 hwndBubble = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3305 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3306
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3307 if(!hwndBubble)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3308 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3309 HPS hpsTemp = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3310 LONG lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3311 LONG lWidth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3312 POINTL txtPointl[TXTBOX_COUNT];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3313 POINTL ptlWork = {0,0};
230
15810221d4ea Don't use DW_CLR_* when making direct OS/2 API calls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 228
diff changeset
3314 ULONG ulColor = CLR_YELLOW;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3315 void *blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3316
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3317 hwndBubbleLast = hwnd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3318 hwndBubble = WinCreateWindow(HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3319 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3320 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3321 SS_TEXT |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3322 DT_CENTER |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3323 DT_VCENTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3324 0,0,0,0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3325 HWND_DESKTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3326 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3327 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3328 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3329 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3330
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3331 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3332 PP_FONTNAMESIZE,
363
eaebef97fc4f Fixed using the default font in the bubble help.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 360
diff changeset
3333 strlen(DefaultFont)+1,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3334 DefaultFont);
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 WinSetPresParam(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3338 PP_BACKGROUNDCOLORINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3339 sizeof(ulColor),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3340 &ulColor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3341
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3342 WinSetWindowText(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3343 bubble->bubbletext);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3344
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3345 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3346
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3347 hpsTemp = WinGetPS(hwndBubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3348 GpiQueryTextBox(hpsTemp,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3349 strlen(bubble->bubbletext),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3350 bubble->bubbletext,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3351 TXTBOX_COUNT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3352 txtPointl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3353 WinReleasePS(hpsTemp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3354
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3355 lWidth = txtPointl[TXTBOX_TOPRIGHT].x -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3356 txtPointl[TXTBOX_TOPLEFT ].x + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3357
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3358 lHight = txtPointl[TXTBOX_TOPLEFT].y -
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3359 txtPointl[TXTBOX_BOTTOMLEFT].y + 8;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3360
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3361 ptlWork.y -= lHight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3362
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3363 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3364
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3365 if(blah)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3366 WinSetWindowPtr(hwndBubble, QWP_USER, blah);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3367
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3368 WinSetWindowPos(hwndBubble,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3369 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3370 ptlWork.x,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3371 ptlWork.y,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3372 lWidth,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3373 lHight,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3374 SWP_SIZE | SWP_MOVE | SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3375 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3376 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3377 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3378
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
3379 if(!oldproc)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3380 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
3381 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3382 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3383
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3384 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3385 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3386 int res = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3387 res = (int)_run_event(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3388 switch(msg)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3389 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
3390 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3391 if(_wndproc(hwnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3392 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3393 break;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3394 case WM_BUTTON1DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3395 case WM_BUTTON2DOWN:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3396 case WM_BUTTON3DOWN:
267
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
3397 if(res == -1)
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
3398 WinSetFocus(HWND_DESKTOP, hwnd);
bf8b907f8a29 Added initial version of updated key_press_event callback.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 257
diff changeset
3399 else if(res)
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3400 return (MPARAM)TRUE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3401 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3402 return WinDefWindowProc(hwnd, msg, mp1, mp2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3403 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3404
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3405 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
3406 {
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
3407 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
3408 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
3409
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3410 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
3411 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
3412
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3413 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
3414 {
529
82a203664aa9 Fixed dw_window_set_pointer() for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 527
diff changeset
3415 case WM_MOUSEMOVE:
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3416 if(_wndproc(hwnd, msg, mp1, mp2))
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3417 return MPFROMSHORT(FALSE);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
3418 break;
128
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3419 case WM_PAINT:
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3420 {
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3421 HPS hps;
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3422 RECTL rcl;
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3423 POINTL ptl[2];
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3424
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3425 if(oldproc)
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 128
diff changeset
3426 oldproc(hwnd, msg, mp1, mp2);
128
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3427
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3428 hps = WinBeginPaint(hwnd, 0, 0);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3429 WinQueryWindowRect(hwnd, &rcl);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3430 ptl[0].x = rcl.xLeft + 1;
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3431 ptl[0].y = rcl.yBottom + 1;
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3432 ptl[1].x = rcl.xRight - 1;
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3433 ptl[1].y = rcl.yTop - 1;
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3434
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3435 GpiSetColor(hps, CLR_BLACK);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3436 GpiMove(hps, &ptl[0]);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3437 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3438 WinEndPaint(hps);
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3439 }
ac616f625443 Draw the splitbar solid pale gray. Maybe we should change this at some
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 127
diff changeset
3440 return MRFROMSHORT(FALSE);
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3441 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
3442 _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
3443 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
3444 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
3445 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
3446 {
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3447 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
3448 _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
3449 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
3450 _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
3451 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
3452 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
3453 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
3454 }
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3455
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3456 _run_event(hwnd, msg, mp1, mp2);
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
3457
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
3458 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
3459 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
3460
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3461 return WinDefWindowProc(hwnd, msg, mp1, mp2);
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3462 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3463
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3464 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3465 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3466 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3467 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3468 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3469 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3470 int API dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3471 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3472 APIRET rc;
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
3473 char objnamebuf[300] = "";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3474
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3475 argc = argc; /* keep compiler happy */
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3476 argv = argv; /* keep compiler happy */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3477 if(newthread)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3478 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3479 dwhab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3480 dwhmq = WinCreateMsgQueue(dwhab, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3481 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3482
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3483 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3484 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3485
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3486 /* Get the OS/2 version. */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
3487 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
3488
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
3489 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE);
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
3490
360
cf66410d03b4 Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 356
diff changeset
3491 if(!IS_WARP4())
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
3492 DefaultFont = "8.Helv";
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
3493
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
3494 /* This is a window that hangs around as long as the
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
3495 * application does and handles menu messages.
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
3496 */
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
3497 hwndApp = dw_window_new(HWND_OBJECT, "", 0);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
3498 DosLoadModule(objnamebuf, sizeof(objnamebuf), "WPCONFIG", &wpconfig);
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
3499
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3500 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3501 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3502
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3503 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3504 * Runs a message loop for Dynamic Windows.
150
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
3505 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3506 void API dw_main(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3507 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3508 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3509
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3510 _dwtid = dw_thread_id();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3511
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3512 while(WinGetMsg(dwhab, &qmsg, 0, 0, 0))
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3513 {
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3514 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3515 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
150
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
3516 WinDispatchMsg(dwhab, &qmsg);
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3517 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3518
150
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
3519 WinDestroyMsgQueue(dwhmq);
2a0d7b57a6da Removed unnecessary parameters from dw_main().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 147
diff changeset
3520 WinTerminate(dwhab);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3521 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3522
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3523 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
3524 * 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
3525 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
3526 * 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
3527 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3528 void API dw_main_sleep(int milliseconds)
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3529 {
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3530 QMSG qmsg;
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3531 #ifdef __EMX__
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3532 struct timeval tv, start;
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3533
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3534 gettimeofday(&start, NULL);
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3535 gettimeofday(&tv, NULL);
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3536
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3537 while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds)
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3538 {
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3539 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3540 {
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3541 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3542 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3543 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3544 WinDispatchMsg(dwhab, &qmsg);
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3545 }
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3546 else
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3547 DosSleep(1);
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3548 gettimeofday(&tv, NULL);
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3549 }
477
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3550 #else
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3551 double start = (double)clock();
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3552
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3553 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds)
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3554 {
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3555 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3556 {
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3557 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3558 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3559 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3560 WinDispatchMsg(dwhab, &qmsg);
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3561 }
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3562 else
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3563 DosSleep(1);
923b46b0716c Had #ifdef __EMX__ round the wrong way in dw_main_sleep(); now fixed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 476
diff changeset
3564 }
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
3565 #endif
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3566 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3567
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
3568 /*
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3569 * Processes a single message iteration and returns.
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3570 */
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3571 void API dw_main_iteration(void)
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3572 {
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3573 QMSG qmsg;
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3574
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3575 _dwtid = dw_thread_id();
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3576
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3577 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0))
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3578 {
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3579 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3580 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3581 WinDispatchMsg(dwhab, &qmsg);
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3582 }
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3583 }
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3584
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
3585 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3586 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3587 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3588 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3589 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3590 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3591 void API dw_free(void *ptr)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3592 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3593 free(ptr);
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 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3598 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3599 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3600 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3601 DWDialog * API dw_dialog_new(void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3602 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3603 DWDialog *tmp = malloc(sizeof(DWDialog));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3604
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3605 tmp->eve = dw_event_new();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3606 dw_event_reset(tmp->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3607 tmp->data = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3608 tmp->done = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3609 tmp->result = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3610
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3611 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3612 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3613
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3614 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3615 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3616 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3617 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3618 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3619 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3620 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3621 int API dw_dialog_dismiss(DWDialog *dialog, void *result)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3622 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3623 dialog->result = result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3624 dw_event_post(dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3625 dialog->done = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3626 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3627 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3628
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3629 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3630 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3631 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3632 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3633 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3634 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3635 void * API dw_dialog_wait(DWDialog *dialog)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3636 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3637 QMSG qmsg;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3638 void *tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3639
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3640 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3641 {
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3642 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
3643 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3644 WinDispatchMsg(dwhab, &qmsg);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3645 if(dialog->done)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3646 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3647 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3648 dw_event_close(&dialog->eve);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3649 tmp = dialog->result;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3650 free(dialog);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3651 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3652 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3653
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3654
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3655 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3656 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3657 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3658 * title: The title of the message box.
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3659 * flags: flags to indicate buttons and icon
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3660 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3661 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3662 */
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3663 int API dw_messagebox(char *title, int flags, char *format, ...)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3664 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3665 va_list args;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3666 char outbuf[1024];
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3667 int rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3668
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3669 va_start(args, format);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3670 vsprintf(outbuf, format, args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3671 va_end(args);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3672
458
768f3546c4b5 Don't make message boxes system modal on OS/2, it is very annoying.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 457
diff changeset
3673 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, flags | MB_MOVEABLE);
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3674 if(rc == MBID_OK)
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3675 return DW_MB_RETURN_OK;
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3676 else if(rc == MBID_YES)
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3677 return DW_MB_RETURN_YES;
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3678 else if(rc == MBID_NO)
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3679 return DW_MB_RETURN_NO;
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3680 else if(rc == MBID_CANCEL)
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3681 return DW_MB_RETURN_CANCEL;
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
3682 else return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3683 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3684
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3685 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3686 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3687 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3688 * 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
3689 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3690 int API dw_window_raise(HWND handle)
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3691 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3692 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
3693 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3694
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3695 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3696 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3697 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3698 * 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
3699 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3700 int API dw_window_lower(HWND handle)
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3701 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3702 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
3703 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3704
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
3705 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3706 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3707 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3708 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3709 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3710 int API dw_window_show(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3711 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3712 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3713 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3714 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3715
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
3716 _fix_button_owner(_toplevel_window(handle), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3717 WinSetFocus(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3718 _initial_focus(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3719
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3720 /* If this window has a switch list entry make sure it is visible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3721 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3722 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3723 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3724 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3725 swcntrl.uchVisibility = SWL_VISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3726 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3727 }
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3728 if(WinWindowFromID(handle, FID_CLIENT))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3729 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3730 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3731
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3732 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
3733 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3734 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
3735 int newx, newy, changed = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3736 SWP swp;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3737
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3738 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3739
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3740 WinQueryWindowPos(handle, &swp);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3741
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3742 newx = swp.x;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3743 newy = swp.y;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3744
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3745 if((swp.x+swp.cx) > cx)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3746 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3747 newx = (cx - swp.cx)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3748 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3749 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3750 if((swp.y+swp.cy) > cy)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3751 {
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3752 newy = (cy - swp.cy)/2;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3753 changed = 1;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3754 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3755 if(changed)
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3756 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
3757 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
3758 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3759 return rc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3760 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3761
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3762 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3763 * 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
3764 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3765 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3766 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3767 int API dw_window_minimize(HWND handle)
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3768 {
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3769 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
3770
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3771 if(hwndclient)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3772 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3773 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
3774
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3775 if(box)
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3776 {
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3777 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
3778 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
3779 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3780 }
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
3781
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3782 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
3783 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3784
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
3785 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3786 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3787 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3788 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3789 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3790 int API dw_window_hide(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3791 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3792 HSWITCH hswitch;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3793 SWCNTRL swcntrl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3794
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3795 /* If this window has a switch list entry make sure it is invisible */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3796 hswitch = WinQuerySwitchHandle(handle, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3797 if(hswitch)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3798 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3799 WinQuerySwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3800 swcntrl.uchVisibility = SWL_INVISIBLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3801 WinChangeSwitchEntry(hswitch, &swcntrl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3802 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3803 return WinShowWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3804 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3805
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3806 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3807 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3808 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3809 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3810 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3811 int API dw_window_destroy(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3812 {
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
3813 HWND frame, menu, parent = WinQueryWindow(handle, QW_PARENT);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3814 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
3815
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3816 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
3817 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
3818
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
3819 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box");
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
3820
468
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
3821 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
3822 _free_menu_data(menu);
0a2f13ba2d5c More menu fixes, free signal handlers and memory on OS/2, and the begining
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 466
diff changeset
3823
210
b9c7b762c104 When comparing the desktop value, use the queried value not the constant.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 207
diff changeset
3824 if(parent != desktop && thisbox && thisbox->count)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3825 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3826 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
3827 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
3828
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3829 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
3830 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3831 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
3832 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
3833 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3834
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3835 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
3836 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
3837
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3838 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
3839
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3840 /* 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
3841 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
3842 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3843 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
3844 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3845 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
3846 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3847 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
3848 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3849
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3850 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
3851 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
3852 thisbox->count--;
408
fecd529ba9d4 Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 406
diff changeset
3853 _free_window_memory(frame ? frame : handle);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3854 }
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
3855 return WinDestroyWindow(frame ? frame : handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3856 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3857
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
3858 /* 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
3859 * 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
3860 * 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
3861 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3862 void API dw_window_redraw(HWND handle)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3863 {
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3864 HWND client = WinWindowFromID(handle, FID_CLIENT);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3865 HWND window = client ? client : handle;
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3866 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
3867
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
3868 _fix_button_owner(_toplevel_window(handle), 0);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3869 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
3870 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3871 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
3872
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3873 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
3874
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3875 WinShowWindow(client ? mybox->items[0].hwnd : handle, FALSE);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3876 _do_resize(mybox, width, height);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
3877 WinShowWindow(client ? mybox->items[0].hwnd : handle, TRUE);
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3878 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3879 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
3880
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3881 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3882 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3883 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3884 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3885 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3886 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3887 void API dw_window_reparent(HWND handle, HWND newparent)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3888 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3889 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3890 WinSetParent(handle, blah ? blah : newparent, TRUE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3891 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3892
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3893 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3894 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3895 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3896 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3897 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3898 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3899 int API dw_window_set_font(HWND handle, char *fontname)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3900 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3901 return WinSetPresParam(handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3902 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3903
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3904 /* Internal version */
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3905 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3906 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3907 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3908 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3909 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3910
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3911 rgb2.bBlue = DW_BLUE_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3912 rgb2.bGreen = DW_GREEN_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3913 rgb2.bRed = DW_RED_VALUE(fore);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3914 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3915
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3916 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3917
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3918 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3919 else if(fore != DW_CLR_DEFAULT)
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3920 {
192
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
3921 fore = _internal_color(fore);
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3922
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3923 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3924 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3925 if((back & DW_RGB_COLOR) == DW_RGB_COLOR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3926 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3927 RGB2 rgb2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3928
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3929 rgb2.bBlue = DW_BLUE_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3930 rgb2.bGreen = DW_GREEN_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3931 rgb2.bRed = DW_RED_VALUE(back);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3932 rgb2.fcOptions = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3933
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3934 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3935 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3936 }
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3937 else if(back != DW_CLR_DEFAULT)
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3938 {
192
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
3939 back = _internal_color(back);
155
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3940
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3941 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3942 }
840c54766306 Another sync of sources, enhancements to dw_window_set_color() ... works
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 154
diff changeset
3943 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3944 }
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3945 /*
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3946 * Sets the colors used by a specified window (widget) handle.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3947 * Parameters:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3948 * handle: The window (widget) handle.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3949 * fore: Foreground color in DW_RGB format or a default color index.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3950 * back: Background color in DW_RGB format or a default color index.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3951 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3952 int API dw_window_set_color(HWND handle, ULONG fore, ULONG back)
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3953 {
228
326e114923cf Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 225
diff changeset
3954 dw_window_set_data(handle, "_dw_fore", (void *)(fore+1));
326e114923cf Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 225
diff changeset
3955 dw_window_set_data(handle, "_dw_back", (void *)(back+1));
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3956
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3957 return _dw_window_set_color(handle, fore, back);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
3958 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3959
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3960 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3961 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3962 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3963 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3964 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3965 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3966 int API dw_window_set_border(HWND handle, int border)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3967 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3968 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3969 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3970 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3971
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3972 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3973 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3974 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3975 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3976 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3977 void API dw_window_capture(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3978 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3979 WinSetCapture(HWND_DESKTOP, handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3980 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3981
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3982 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3983 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3984 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3985 void API dw_window_release(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3986 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3987 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3988 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3989
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3990 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3991 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3992 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3993 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3994 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3995 void API dw_window_track(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3996 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3997 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3998 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3999
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4000 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4001 * 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
4002 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4003 * 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
4004 * 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
4005 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
4006 void API dw_window_set_pointer(HWND handle, int pointertype)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4007 {
530
27533e1ccaf5 More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 529
diff changeset
4008 HPOINTER pointer = pointertype < 65535 ?
27533e1ccaf5 More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 529
diff changeset
4009 WinQuerySysPointer(HWND_DESKTOP, pointertype, FALSE)
27533e1ccaf5 More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 529
diff changeset
4010 : (HPOINTER)pointertype;
27533e1ccaf5 More pointer cleanup on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 529
diff changeset
4011
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4012 if(!pointertype)
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4013 dw_window_set_data(handle, "_dw_pointer", 0);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4014 else
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4015 {
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4016 WinSetPointer(HWND_DESKTOP, pointer);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4017
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4018 if(handle != HWND_DESKTOP)
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4019 dw_window_set_data(handle, "_dw_pointer", (void *)pointer);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4020 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4021 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4022
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4023 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4024 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4025 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4026 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4027 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4028 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4029 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4030 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4031 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4032 HWND hwndframe;
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
4033 Box *newbox = calloc(1, sizeof(Box));
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4034 WindowData *blah = calloc(1, sizeof(WindowData));
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4035 ULONG winStyle = 0L;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4036
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4037 newbox->pad = 0;
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
4038 newbox->type = DW_VERT;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4039 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4040
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4041 flStyle |= FCF_NOBYTEALIGN;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4042
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
4043 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
4044 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
4045 else
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
4046 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
4047
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4048 if(!(flStyle & FCF_SHELLPOSITION))
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4049 blah->flags |= DW_OS2_NEW_WINDOW;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4050
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4051 if(flStyle & WS_MAXIMIZED)
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4052 {
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4053 winStyle |= WS_MAXIMIZED;
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4054 flStyle &= ~WS_MAXIMIZED;
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4055 }
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4056 if(flStyle & WS_MINIMIZED)
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4057 {
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4058 winStyle |= WS_MINIMIZED;
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4059 flStyle &= ~WS_MINIMIZED;
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4060 }
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4061
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4062 hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &newbox->hwnd);
39
3aa9ef0b3996 Added focus fixes and set-focus fixes on all three platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 38
diff changeset
4063 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
4064 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
4065 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4066 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4067 WinSetWindowPtr(hwndframe, QWP_USER, blah);
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4068 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4069
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4070 return hwndframe;
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 Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4075 * Parameters:
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
4076 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4077 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4078 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4079 HWND API dw_box_new(int type, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4080 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
4081 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4082
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4083 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4084 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4085 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4086 newbox->grouphwnd = NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4087
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4088 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4089 WC_FRAME,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4090 NULL,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4091 WS_VISIBLE | WS_CLIPCHILDREN |
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4092 FS_NOBYTEALIGN,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4093 0,0,2000,1000,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4094 NULLHANDLE,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4095 HWND_TOP,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4096 0L,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4097 NULL,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4098 NULL);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4099
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4100 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _controlproc);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4101 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4102 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4103 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4104 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4105
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4106 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4107 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4108 * Parameters:
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
4109 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4110 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4111 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4112 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4113 HWND API dw_groupbox_new(int type, int pad, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4114 {
8
e22584460709 Switched allocating the box structs with calloc instead of malloc so
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 7
diff changeset
4115 Box *newbox = calloc(1, sizeof(Box));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4116 newbox->pad = pad;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4117 newbox->type = type;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4118 newbox->count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4119
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4120 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4121 WC_FRAME,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4122 NULL,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4123 WS_VISIBLE |
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4124 FS_NOBYTEALIGN,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4125 0,0,2000,1000,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4126 NULLHANDLE,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4127 HWND_TOP,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4128 0L,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4129 NULL,
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4130 NULL);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4131
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4132 newbox->grouphwnd = WinCreateWindow(newbox->hwnd,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4133 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4134 title,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4135 WS_VISIBLE | SS_GROUPBOX |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4136 WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4137 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4138 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4139 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4140 0L,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4141 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4142 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4143
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4144 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4145 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4146 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4147 dw_window_set_font(newbox->grouphwnd, DefaultFont);
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
4148 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4150
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4151 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4152 * 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
4153 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4154 * 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
4155 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4156 HWND API dw_mdi_new(unsigned long id)
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4157 {
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4158 HWND hwndframe;
523
b2065b0c39c1 Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 516
diff changeset
4159 ULONG back = CLR_DARKGRAY;
b2065b0c39c1 Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 516
diff changeset
4160
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4161 hwndframe = WinCreateWindow(HWND_OBJECT,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4162 WC_FRAME,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4163 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
4164 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
4165 FS_NOBYTEALIGN,
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4166 0,0,2000,1000,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4167 NULLHANDLE,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4168 HWND_TOP,
523
b2065b0c39c1 Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 516
diff changeset
4169 id,
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4170 NULL,
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4171 NULL);
523
b2065b0c39c1 Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 516
diff changeset
4172 /* Make the MDI Client area the same color as Windows and Unix */
b2065b0c39c1 Minor MDI fixes, tried to fix the y-axis problem for OS/2 boxes but it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 516
diff changeset
4173 WinSetPresParam(hwndframe, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4174 return hwndframe;
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4175 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4176
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4177 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4178 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4179 * Parameters:
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4180 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4181 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4182 HWND API dw_bitmap_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4183 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4184 return WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4185 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4186 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4187 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4188 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4189 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4190 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4191 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4192 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4193 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4194 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4195
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4196 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4197 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4198 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4199 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4200 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4201 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4202 HWND API dw_notebook_new(ULONG id, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4203 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4204 ULONG flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4205 HWND tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4206
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4207 if(top)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4208 flags = BKS_MAJORTABTOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4209 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4210 flags = BKS_MAJORTABBOTTOM;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4211
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4212 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4213 WC_NOTEBOOK,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4214 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4215 WS_VISIBLE |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4216 #ifdef BKS_TABBEDDIALOG
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4217 BKS_TABBEDDIALOG |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4218 #endif
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4219 flags,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4220 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4221 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4222 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4223 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4224 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4225 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4226
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
4227 /* Fix tab sizes on Warp 3 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
4228 if(!IS_WARP4())
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
4229 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
4230 /* 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
4231 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
4232 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
4233
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4234 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4235 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4236 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4237
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4238 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4239 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4240 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4241 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4242 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4243 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4244 HMENUI API dw_menu_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4245 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4246 HMENUI tmp = WinCreateWindow(HWND_OBJECT,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4247 WC_MENU,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4248 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4249 WS_VISIBLE,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4250 0,0,2000,1000,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4251 NULLHANDLE,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4252 HWND_TOP,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4253 id,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4254 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4255 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4256 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4257 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4258
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4259 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4260 * Create a menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4261 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4262 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4263 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4264 HMENUI API dw_menubar_new(HWND location)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4265 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4266 HMENUI tmp = WinCreateWindow(location,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4267 WC_MENU,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4268 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4269 WS_VISIBLE | MS_ACTIONBAR,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4270 0,0,2000,1000,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4271 location,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4272 HWND_TOP,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4273 FID_MENU,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4274 NULL,
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4275 NULL);
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4276 dw_window_set_data(tmp, "_dw_owner", (void *)location);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4277 dw_window_set_data(tmp, "_dw_menubar", (void *)location);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4278 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4279 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4280
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4281 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4282 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4283 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4284 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4285 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4286 void API dw_menu_destroy(HMENUI *menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4287 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4288 if(menu)
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4289 WinDestroyWindow(*menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4290 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4291
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4292 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4293 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4294 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4295 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4296 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4297 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4298 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4299 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4300 * check: If TRUE menu is "check"able.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4301 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4302 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4303 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG id, ULONG flags, int end, int check, HMENUI submenu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4304 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4305 MENUITEM miSubMenu;
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4306 char buffer[15];
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4307
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4308 check = check; /* keep compiler happy */
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4309 if(!menux || id > 65536)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4310 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4311
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4312 if(end)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4313 miSubMenu.iPosition=MIT_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4314 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4315 miSubMenu.iPosition=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4316
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4317 if(strlen(title) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4318 miSubMenu.afStyle=MIS_SEPARATOR | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4319 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4320 miSubMenu.afStyle=MIS_TEXT | flags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4321 miSubMenu.afAttribute=0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4322 miSubMenu.id=id;
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4323 miSubMenu.hwndSubMenu = submenu;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4324 miSubMenu.hItem=NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4325
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4326 WinSendMsg(menux,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4327 MM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4328 MPFROMP(&miSubMenu),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4329 MPFROMP(title));
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4330
543
8217ee5c254e Get EMX compiling again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 541
diff changeset
4331 sprintf(buffer, "_dw_id%d", (int)id);
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4332 dw_window_set_data(hwndApp, buffer, (void *)menux);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4333
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4334 if(submenu)
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
4335 dw_window_set_data(submenu, "_dw_owner", (void *)menux);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4336 return (HWND)id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4337 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4338
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4339 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4340 * Sets the state of a menu item check.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4341 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4342 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4343 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4344 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4345 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4346 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4347 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4348 if(check)
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4349 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4350 MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4351 else
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4352 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4353 MPFROM2SHORT(MIA_CHECKED, 0));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4354 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4355
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4356 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4357 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4358 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4359 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4360 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4361 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4362 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4363 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4364 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4365 {
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4366 if(menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4367 {
93
98cce029a611 Changed handling of menu item click events.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 90
diff changeset
4368 popup = parent;
499
b658d9628f41 Ok, so the code I just removed wasn't quite as bogus as I thought, but it
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 498
diff changeset
4369 dw_window_set_data(*menu, "_dw_popup", (void *)1);
185
f55677513954 Updated the menu code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 183
diff changeset
4370 WinPopupMenu(HWND_DESKTOP, parent, *menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4371 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4372 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4373
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4374 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4375 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4376 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4377 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4378 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4379 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4380 void API dw_pointer_query_pos(long *x, long *y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4381 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4382 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4383
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4384 WinQueryPointerPos(HWND_DESKTOP, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4385 if(x && y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4386 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4387 *x = ptl.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4388 *y = dw_screen_height() - ptl.y;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4389 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4390 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4391
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4392 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4393 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4394 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4395 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4396 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4397 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4398 void API dw_pointer_set_pos(long x, long y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4399 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4400 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4401 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4402
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
4403
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4404 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4405 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4406 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4407 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4408 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4409 */
350
2216e65ad2ae Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 347
diff changeset
4410 HWND API dw_container_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4411 {
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
4412 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4413 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4414 WC_CONTAINER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4415 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4416 WS_VISIBLE | CCS_READONLY |
350
2216e65ad2ae Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 347
diff changeset
4417 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) |
2216e65ad2ae Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 347
diff changeset
4418 CCS_AUTOPOSITION,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4419 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4420 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4421 HWND_TOP,
500
fe12a72bfddf Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 499
diff changeset
4422 id ? id : (GlobalID++),
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4423 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4424 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
4425 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
4426 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4427 dw_window_set_font(tmp, DefaultFont);
161
c555d06b6c93 Allow tree-select signal to work on container controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 160
diff changeset
4428 dw_window_set_data(tmp, "_dw_container", (void *)1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4429 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4430 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4431
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4432 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4433 * 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
4434 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4435 * 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
4436 * 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
4437 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4438 HWND API dw_tree_new(ULONG id)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4439 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4440 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
4441 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
4442 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
4443 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
4444 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4445 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
4446 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
4447 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
4448 NULLHANDLE,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4449 HWND_TOP,
500
fe12a72bfddf Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 499
diff changeset
4450 id ? id : (GlobalID++),
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4451 NULL,
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4452 NULL);
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4453
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4454 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
4455 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
4456 cnrinfo.slBitmapOrIcon.cy = 16;
108
108674099806 Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 103
diff changeset
4457 cnrinfo.cyLineSpacing = 0;
108674099806 Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 103
diff changeset
4458 cnrinfo.cxTreeIndent = 16;
108674099806 Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 103
diff changeset
4459 cnrinfo.cxTreeLine = 1;
108674099806 Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 103
diff changeset
4460
108674099806 Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 103
diff changeset
4461 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON |
108674099806 Changed some of the default spacings for the tree control on OS/2 so it is
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 103
diff changeset
4462 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE));
67
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
4463 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
4464 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
4465 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
4466 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
4467 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4468
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4469 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4470 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4471 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4472 * text: The text to be display by the static text widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4473 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4474 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4475 HWND API dw_text_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4476 {
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4477 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4478 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4479 WC_STATIC,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4480 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4481 WS_VISIBLE | SS_TEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4482 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4483 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4484 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4485 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4486 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4487 NULL);
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4488 blah->oldproc = WinSubclassWindow(tmp, _textproc);
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
4489 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4490 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4491 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4492 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4493 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4494
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4495 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4496 * 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
4497 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4498 * text: The text to be display by the static text widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4499 * id: An ID to be used with dw_window_from_id() or 0L.
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4500 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4501 HWND API dw_status_text_new(char *text, ULONG id)
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4502 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4503 WindowData *blah = calloc(sizeof(WindowData), 1);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4504 HWND tmp = WinCreateWindow(HWND_OBJECT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4505 WC_STATIC,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4506 text,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4507 WS_VISIBLE | SS_TEXT,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4508 0,0,2000,1000,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4509 NULLHANDLE,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4510 HWND_TOP,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4511 id,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4512 NULL,
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4513 NULL);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4514 blah->oldproc = WinSubclassWindow(tmp, _statusproc);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4515 WinSetWindowPtr(tmp, QWP_USER, blah);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4516 dw_window_set_font(tmp, DefaultFont);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4517 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
4518 return tmp;
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4519 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4520
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4521 #ifndef MLS_LIMITVSCROLL
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4522 #define MLS_LIMITVSCROLL 0x00000080L
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4523 #endif
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
4524
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
4525 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4526 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4527 * Parameters:
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4528 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4529 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4530 HWND API dw_mle_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4531 {
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4532 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4533 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4534 WC_MLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4535 "",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4536 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4537 MLS_BORDER | MLS_IGNORETAB |
152
e78027768548 Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
4538 MLS_READONLY | MLS_VSCROLL |
e78027768548 Added MLS_LIMITVSCROLL to the MLE style.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 151
diff changeset
4539 MLS_LIMITVSCROLL,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4540 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4541 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4542 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4543 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4544 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4545 NULL);
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
4546 blah->oldproc = WinSubclassWindow(tmp, _mleproc);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
4547 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4548 dw_window_set_font(tmp, DefaultFont);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4549 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4550 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4551
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4552 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4553 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4554 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4555 * text: The default text to be in the entryfield widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4556 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4557 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4558 HWND API dw_entryfield_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4559 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4560
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4561 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4562 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4563 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4564 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4565 WS_VISIBLE | ES_MARGIN |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4566 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4567 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4568 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4569 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4570 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4571 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4572 NULL);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4573 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4574 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4575 dw_window_set_font(tmp, DefaultFont);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4576 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4577 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4578 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4579
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4580 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4581 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4582 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4583 * text: The default text to be in the entryfield widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4584 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4585 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4586 HWND API dw_entryfield_password_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4587 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4588 WindowData *blah = calloc(1, sizeof(WindowData));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4589 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4590 WC_ENTRYFIELD,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4591 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4592 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4593 ES_AUTOSCROLL | WS_TABSTOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4594 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4595 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4596 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4597 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4598 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4599 NULL);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4600 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4601 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4602 dw_window_set_font(tmp, DefaultFont);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4603 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4604 return tmp;
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4608 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4609 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4610 * text: The default text to be in the combpbox widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4611 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4612 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4613 HWND API dw_combobox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4614 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4615 WindowData *blah = calloc(1, sizeof(WindowData));
408
fecd529ba9d4 Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 406
diff changeset
4616 HWND frame = dw_box_new(DW_HORZ, 0);
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
4617 HWND tmp = WinCreateWindow(frame,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4618 WC_COMBOBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4619 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4620 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4621 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4622 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4623 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4624 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4625 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4626 NULL);
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4627 HENUM henum = WinBeginEnumWindows(tmp);
377
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
4628 HWND child, last = NULLHANDLE;
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4629
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4630 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
4631 {
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4632 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
4633 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4634 WinSetWindowPtr(child, QWP_USER, moreblah);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4635 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE);
377
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
4636 last = child;
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4637 }
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
4638 WinEndEnumWindows(henum);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4639 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4640 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4641 dw_window_set_font(tmp, DefaultFont);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4642 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
377
d8176c73a081 Fixes for drawing of the combobox on OS/2. It now queries the entryfield
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 376
diff changeset
4643 dw_window_set_data(tmp, "_dw_comboentry", (void *)last);
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
4644 dw_window_set_data(tmp, "_dw_combo_box", (void *)frame);
408
fecd529ba9d4 Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 406
diff changeset
4645 WinSetOwner(tmp, frame);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4646 return tmp;
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 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4651 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4652 * text: The text to be display by the static text widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4653 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4654 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4655 HWND API dw_button_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4656 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4657 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4658
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4659 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4660 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4661 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4662 WS_VISIBLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4663 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4664 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4665 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4666 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4667 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4668 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4669
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4670 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4671 bubble->bubbletext[0] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4672 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4673
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4674 WinSetWindowPtr(tmp, QWP_USER, bubble);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4675 dw_window_set_font(tmp, DefaultFont);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4676 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4677 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4678 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4679
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4680 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4681 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4682 ** controls
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 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4686 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4687 char *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4688 int slen = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4689
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4690 *buff++ = '#';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4691
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4692 str = buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4693
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4694 do
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4695 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4696 *str++ = (ulID % 10) + '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4697 ulID /= 10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4698 slen++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4699 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4700 while(ulID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4701
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4702 *str-- = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4703
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4704 for(; str > buff; str--, buff++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4705 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4706 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4707 *str ^= *buff;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4708 *buff ^= *str;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4709 }
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4714 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4715 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4716 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4717 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4718 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4719 HWND API dw_bitmapbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4720 {
551
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4721 char idbuf[256], *name = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4722 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
4723 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
551
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4724 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id);
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4725
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4726 if(!icon)
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4727 {
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4728 name = idbuf;
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4729 _GenResIDStr(idbuf, id);
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4730 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4732 tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4733 WC_BUTTON,
551
756477206006 Try to load icons for dw_bitmapbutton_new() before bitmaps from the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 548
diff changeset
4734 name,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4735 WS_VISIBLE | BS_PUSHBUTTON |
553
788299414ae0 Fixes for resource based bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 551
diff changeset
4736 BS_NOPOINTERFOCUS | BS_AUTOSIZE |
788299414ae0 Fixes for resource based bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 551
diff changeset
4737 (icon ? 0 : BS_BITMAP),
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4738 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4739 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4740 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4741 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4742 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4743 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4744
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4745 bubble->id = id;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4746 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4747 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4748 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4749
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4750 WinSetWindowPtr(tmp, QWP_USER, bubble);
553
788299414ae0 Fixes for resource based bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 551
diff changeset
4751
788299414ae0 Fixes for resource based bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 551
diff changeset
4752 if(icon)
788299414ae0 Fixes for resource based bitmap buttons using icons.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 551
diff changeset
4753 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon);
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
4754 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4755 return tmp;
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 /*
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4759 * Create a new bitmap button window (widget) to be packed from a file.
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4760 * Parameters:
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4761 * text: Bubble help text to be displayed.
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4762 * id: An ID to be used with dw_window_from_id() or 0L.
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4763 * filename: Name of the file, omit extention to have
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4764 * DW pick the appropriate file extension.
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4765 * (BMP on OS/2 or Windows, XPM on Unix)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4766 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
4767 HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename)
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4768 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4769 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4770 HWND tmp = WinCreateWindow(HWND_OBJECT,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4771 WC_BUTTON,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4772 "",
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4773 WS_VISIBLE | BS_PUSHBUTTON |
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4774 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4775 0,0,2000,1000,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4776 NULLHANDLE,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4777 HWND_TOP,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4778 id,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4779 NULL,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4780 NULL);
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4781 char *file = alloca(strlen(filename) + 5);
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
4782 HPIXMAP pixmap = NULL, disabled = NULL;
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4783 HPOINTER icon = 0;
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4784
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4785 if(file && (pixmap = calloc(1,sizeof(struct _hpixmap))))
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4786 {
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4787 int z, j, lim, len;
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
4788 LONG fore;
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
4789
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4790 strcpy(file, filename);
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4791
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4792 /* check if we can read from this file (it exists and read permission) */
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4793 if(access(file, 04) == 0)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4794 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4795 len = strlen( file );
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4796 if(len > 4)
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4797 {
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4798 if(stricmp(file + len - 4, ".ico") == 0)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4799 icon = WinLoadFileIcon(file, FALSE);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4800 else
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4801 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4802 }
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4803 }
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4804 else
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4805 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4806 /* Try with .ico extension first...*/
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4807 strcat(file, ".ico");
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4808 if(access(file, 04) == 0)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4809 icon = WinLoadFileIcon(file, FALSE);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4810 else
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4811 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4812 strcpy(file, filename);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4813 strcat(file, ".bmp");
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4814 if(access(file, 04) == 0)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4815 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height);
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4816 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4817 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4818
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4819 if(icon)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4820 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4821 free(pixmap);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4822 pixmap = NULL;
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4823 }
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4824 else
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4825 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4826 /* Create a disabled style pixmap */
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4827 disabled = dw_pixmap_new(tmp, pixmap->width, pixmap->height, dw_color_depth_get());
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4828 dw_pixmap_bitblt(0, disabled, 0, 0, pixmap->width, pixmap->height, 0, pixmap, 0, 0);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4829
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4830 fore = _foreground;
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4831 dw_color_foreground_set(DW_CLR_PALEGRAY);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4832 lim = pixmap->width/2;
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4833 for(j=0;j<pixmap->height;j++)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4834 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4835 int mod = j%2;
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4836
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4837 for(z=0;z<lim;z++)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4838 dw_draw_point(0, disabled, (z*2)+mod, j);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4839 }
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4840 _foreground = fore;
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4841 }
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4842 }
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4843
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4844 bubble->id = id;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4845 strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4846 bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4847 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4848
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4849 WinSetWindowPtr(tmp, QWP_USER, bubble);
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
4850
546
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4851 if(icon)
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4852 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4853 else
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4854 {
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4855 dw_window_set_data(tmp, "_dw_hpixmap", (void *)pixmap);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4856 dw_window_set_data(tmp, "_dw_hpixmap_disabled", (void *)disabled);
dac29596615d Added icon support to dw_bitmapbutton_from_file() but it seems to be using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 545
diff changeset
4857 }
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
4858 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1);
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4859 return tmp;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4860 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4861
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4862 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4863 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4864 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4865 * text: The text to be display by the static text widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4866 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4867 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4868 HWND API dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4869 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4870 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4871 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4872 WC_SPINBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4873 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4874 WS_VISIBLE | SPBS_MASTER,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4875 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4876 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4877 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4878 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4879 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4880 NULL);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4881 HWND entry = _find_entryfield(tmp);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4882 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4883 WinSetWindowPtr(tmp, QWP_USER, blah);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4884 blah = calloc(sizeof(WindowData), 1);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4885 blah->oldproc = WinSubclassWindow(entry, _spinentryproc);
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
4886 WinSetWindowPtr(entry, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4887 dw_window_set_font(tmp, DefaultFont);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4888 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4889 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4890 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4891
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4892 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4893 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4894 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4895 * text: The text to be display by the static text widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4896 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4897 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4898 HWND API dw_radiobutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4899 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
4900 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4901 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4902 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4903 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4904 WS_VISIBLE |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4905 BS_AUTORADIOBUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4906 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4907 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4908 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4909 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4910 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4911 NULL);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4912 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4913 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4914 dw_window_set_font(tmp, DefaultFont);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4915 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4916 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4917 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4918
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4919
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4920 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4921 * 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
4922 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4923 * 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
4924 * increments: Number of increments available.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4925 * id: An ID to be used with dw_window_from_id() or 0L.
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4926 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4927 HWND API dw_slider_new(int vertical, int increments, ULONG id)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4928 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4929 WindowData *blah = calloc(1, sizeof(WindowData));
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4930 SLDCDATA sldcData = { 0, 0, 0, 0, 0 };
178
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4931 HWND tmp;
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4932
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4933 sldcData.cbSize = sizeof(SLDCDATA);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
4934 sldcData.usScale1Increments = increments;
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4935
178
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4936 tmp = WinCreateWindow(HWND_OBJECT,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4937 WC_SLIDER,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4938 "",
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4939 WS_VISIBLE | SLS_SNAPTOINCREMENT |
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4940 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL),
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4941 0,0,2000,1000,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4942 NULLHANDLE,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4943 HWND_TOP,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4944 id,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4945 &sldcData,
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4946 NULL);
770da0fc4c0d Fixed a small regression from the watcom changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 175
diff changeset
4947
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4948 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
4949 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
4950 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
4951 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4952
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4953 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4954 * Create a new scrollbar window (widget) to be packed.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4955 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4956 * vertical: TRUE or FALSE if scrollbar is vertical.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4957 * increments: Number of increments available.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4958 * id: An ID to be used with dw_window_from_id() or 0L.
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4959 */
511
80dbd5a1f403 Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 510
diff changeset
4960 HWND API dw_scrollbar_new(int vertical, ULONG id)
80dbd5a1f403 Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 510
diff changeset
4961 {
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4962 return WinCreateWindow(HWND_OBJECT,
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4963 WC_SCROLLBAR,
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4964 "",
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4965 WS_VISIBLE | SBS_AUTOTRACK |
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4966 (vertical ? SBS_VERT : SBS_HORZ),
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4967 0,0,2000,1000,
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4968 NULLHANDLE,
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4969 HWND_TOP,
500
fe12a72bfddf Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 499
diff changeset
4970 id ? id : (GlobalID++),
207
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4971 NULL,
767fca804cea Fixed scrollbar value_change on OS/2... ID must be set on the scrollbar,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 203
diff changeset
4972 NULL);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4973 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4974
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
4975 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4976 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4977 * Parameters:
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
4978 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4979 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4980 HWND API dw_percent_new(ULONG id)
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4981 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4982 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
4983 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
4984 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
4985 "",
62
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4986 WS_VISIBLE | SLS_READONLY
2be5174bdb5d Sync with latest DW code. Tab and RGB fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 61
diff changeset
4987 | 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
4988 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
4989 NULLHANDLE,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4990 HWND_TOP,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4991 id,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4992 NULL,
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4993 NULL);
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
4994 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
4995 WinSetWindowPtr(tmp, QWP_USER, blah);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
4996 dw_window_disable(tmp);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
4997 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4998 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4999
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5000 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5001 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5002 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5003 * text: The text to be display by the static text widget.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5004 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5005 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5006 HWND API dw_checkbox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5007 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
5008 BubbleButton *bubble = calloc(sizeof(BubbleButton), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5009 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5010 WC_BUTTON,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5011 text,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5012 WS_VISIBLE | BS_AUTOCHECKBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5013 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5014 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5015 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5016 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5017 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5018 NULL);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5019 bubble->id = id;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5020 bubble->bubbletext[0] = '\0';
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5021 bubble->pOldProc = WinSubclassWindow(tmp, _BtProc);
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
5022 WinSetWindowPtr(tmp, QWP_USER, bubble);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
5023 dw_window_set_font(tmp, DefaultFont);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
5024 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5025 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5026 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5027
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5028 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5029 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5030 * Parameters:
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5031 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5032 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5033 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5034 HWND API dw_listbox_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5035 {
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
5036 WindowData *blah = calloc(sizeof(WindowData), 1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5037 HWND tmp = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5038 WC_LISTBOX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5039 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5040 WS_VISIBLE | LS_NOADJUSTPOS |
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5041 (multi ? LS_MULTIPLESEL : 0),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5042 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5043 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5044 HWND_TOP,
500
fe12a72bfddf Added a GlobalID which should allow code written on GTK or Windows to work
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 499
diff changeset
5045 id ? id : (GlobalID++),
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5046 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5047 NULL);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
5048 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
5049 WinSetWindowPtr(tmp, QWP_USER, blah);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5050 dw_window_set_font(tmp, DefaultFont);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5051 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5052 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5053 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5054
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5055 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5056 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5057 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5058 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5059 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5060 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5061 void API dw_window_set_icon(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5062 {
336
a2f72b5d5d0a Minor change to dw_window_set_icon() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 328
diff changeset
5063 HPOINTER icon = id < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,id) : (HPOINTER)id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5064 WinSendMsg(handle, WM_SETICON, (MPARAM)icon, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5065 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5066
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5067 /* Internal function to load a bitmap from a file and return handles
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5068 * to the bitmap, presentation space etc.
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5069 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5070 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5071 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5072 HFILE BitmapFileHandle = NULLHANDLE; /* handle for the file */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5073 ULONG OpenAction = 0;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5074 PBYTE BitmapFileBegin; /* pointer to the first byte of bitmap data */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5075 FILESTATUS BitmapStatus;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5076 ULONG cbRead;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5077 PBITMAPFILEHEADER2 pBitmapFileHeader;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5078 PBITMAPINFOHEADER2 pBitmapInfoHeader;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5079 ULONG ScanLines, ulFlags;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5080 HPS hps1;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5081 HDC hdc1;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5082 SIZEL sizl = { 0, 0 };
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5083
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5084 /* open bitmap file */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5085 DosOpen(file, &BitmapFileHandle, &OpenAction, 0L,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5086 FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5087 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5088 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY |
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5089 OPEN_FLAGS_NOINHERIT, 0L);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5090
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5091 if(!BitmapFileHandle)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5092 return 0;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5093
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5094 /* find out how big the file is */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5095 DosQueryFileInfo(BitmapFileHandle, 1, &BitmapStatus,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5096 sizeof(BitmapStatus));
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5097
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5098 /* allocate memory to load the bitmap */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5099 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)BitmapStatus.cbFile,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5100 PAG_READ | PAG_WRITE | PAG_COMMIT);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5101
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5102 /* read bitmap file into memory buffer */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5103 DosRead(BitmapFileHandle, (PVOID)BitmapFileBegin,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5104 BitmapStatus.cbFile, &cbRead);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5105
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5106 /* access first bytes as bitmap header */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5107 pBitmapFileHeader = (PBITMAPFILEHEADER2)BitmapFileBegin;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5108
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5109 /* check if it's a valid bitmap data file */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5110 if((pBitmapFileHeader->usType != BFT_BITMAPARRAY) &&
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5111 (pBitmapFileHeader->usType != BFT_BMAP))
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5112 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5113 /* free memory of bitmap file buffer */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5114 DosFreeMem(BitmapFileBegin);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5115 /* close the bitmap file */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5116 DosClose(BitmapFileHandle);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5117 return 0;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5118 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5119
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5120 /* check if it's a file with multiple bitmaps */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5121 if(pBitmapFileHeader->usType == BFT_BITMAPARRAY)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5122 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5123 /* we'll just use the first bitmap and ignore the others */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5124 pBitmapFileHeader = &(((PBITMAPARRAYFILEHEADER2)BitmapFileBegin)->bfh2);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5125 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5126
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5127 /* set pointer to bitmap information block */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5128 pBitmapInfoHeader = &pBitmapFileHeader->bmp2;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5129
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5130 /* find out if it's the new 2.0 format or the old format */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5131 /* and query number of lines */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5132 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER))
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5133 {
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5134 *height = ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy;
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5135 *width = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cx;
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5136 }
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5137 else
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5138 {
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5139 *height = ScanLines = pBitmapInfoHeader->cy;
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5140 *width = pBitmapInfoHeader->cx;
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
5141 }
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5142
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5143 /* now we need a presentation space, get it from static control */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5144 hps1 = WinGetPS(handle);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5145
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5146 hdc1 = GpiQueryDevice(hps1);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5147 ulFlags = GpiQueryPS(hps1, &sizl);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5148
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5149 *hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc1);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5150 *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5151
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5152 /* create bitmap now using the parameters from the info block */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5153 *hbm = GpiCreateBitmap(*hps, pBitmapInfoHeader, 0L, NULL, NULL);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5154
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5155 /* select the new bitmap into presentation space */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5156 GpiSetBitmap(*hps, *hbm);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5157
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5158 /* now copy the bitmap data into the bitmap */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5159 GpiSetBitmapBits(*hps, 0L, ScanLines,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5160 BitmapFileBegin + pBitmapFileHeader->offBits,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5161 (PBITMAPINFO2)pBitmapInfoHeader);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5162
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5163 WinReleasePS(hps1);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5164
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5165 /* free memory of bitmap file buffer */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5166 DosFreeMem(BitmapFileBegin);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5167 /* close the bitmap file */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5168 DosClose(BitmapFileHandle);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5169 return 1;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5170 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5171
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5172 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5173 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5174 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5175 * handle: Handle to the window.
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5176 * id: An ID to be used to specify the icon,
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5177 * (pass 0 if you use the filename param)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5178 * filename: a path to a file (Bitmap on OS/2 or
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5179 * Windows and a pixmap on Unix, pass
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5180 * NULL if you use the id param)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5181 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5182 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5183 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5184 HBITMAP hbm;
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5185 HPS hps;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5186
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5187 /* Destroy any old bitmap data */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5188 _free_bitmap(handle);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5189
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5190 /* If id is non-zero use the resource */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5191 if(id)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5192 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5193 hps = WinGetPS(handle);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5194
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5195 hbm = GpiLoadBitmap(hps, NULLHANDLE, id, 0, 0);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5196 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5197 else if(filename)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5198 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5199 HDC hdc;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5200 unsigned long width, height;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5201 char *file = alloca(strlen(filename) + 5);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5202
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5203 if(!file)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5204 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5205
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5206 strcpy(file, filename);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5207
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5208 /* check if we can read from this file (it exists and read permission) */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5209 if(access(file, 04) != 0)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5210 {
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5211 /* Try with .bmp extention */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5212 strcat(file, ".bmp");
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5213 if(access(file, 04) != 0)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5214 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5215 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5216
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5217 if(!_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height))
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5218 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5219
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5220 dw_window_set_data(handle, "_dw_hps", (void *)hps);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5221 dw_window_set_data(handle, "_dw_hdc", (void *)hdc);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5222 dw_window_set_data(handle, "_dw_width", (void *)width);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5223 dw_window_set_data(handle, "_dw_height", (void *)height);
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5224 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5225 else
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5226 return;
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5227
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5228 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5229 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL );
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5230 if(id)
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5231 WinReleasePS(hps);
235
69f2a59ec7d0 Delete associated bitmaps when destroying windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 230
diff changeset
5232 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5233 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5234
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5235 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5236 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5237 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5238 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5239 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5240 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5241 void API dw_window_set_text(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5242 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5243 WinSetWindowText(handle, text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5244 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5245
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5246 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5247 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5248 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5249 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5250 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5251 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5252 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5253 char * API dw_window_get_text(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5254 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
5255 int len = WinQueryWindowTextLength(handle);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
5256 char *tempbuf = calloc(1, len + 2);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
5257
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
5258 WinQueryWindowText(handle, len + 1, tempbuf);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
5259
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
5260 return tempbuf;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5261 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5262
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5263 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5264 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5265 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5266 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5267 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5268 void API dw_window_disable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5269 {
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5270 char tmpbuf[100];
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5271
166
fb2987817924 Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5272 if(dw_window_get_data(handle, "_dw_disabled"))
fb2987817924 Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5273 return;
fb2987817924 Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5274
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5275 WinQueryClassName(handle, 99, tmpbuf);
166
fb2987817924 Optimize disabling of controls... if already disabled do nothing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 161
diff changeset
5276 dw_window_set_data(handle, "_dw_disabled", (void *)1);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5277
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5278 if(tmpbuf[0] == '#')
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5279 {
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5280 int val = atoi(&tmpbuf[1]);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5281 HWND hwnd;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5282
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5283 switch(val)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5284 {
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5285 case 2:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5286 case 6:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5287 case 10:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5288 case 32:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5289 case 7:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5290 hwnd = _find_entryfield(handle);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5291 _dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY);
307
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
5292 dw_signal_connect(hwnd ? hwnd : handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
160
76bc6b4e8b79 Don't allow comboboxes to drop down when disabled.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 159
diff changeset
5293 if(val == 2)
307
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
5294 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5295 if(hwnd)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5296 dw_window_set_data(hwnd, "_dw_disabled", (void *)1);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5297 return;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5298 case 3:
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5299 if(dw_window_get_data(handle, "_dw_bitmapbutton") && !dw_window_get_data(handle, "_dw_hpixmap"))
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5300 WinEnableWindow(handle, FALSE);
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5301 else if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled"))
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5302 WinInvalidateRect(handle, NULL, FALSE);
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5303 else
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5304 _dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY);
307
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
5305 dw_signal_connect(handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
324587c06cea Use the signal #defines internally so all that is required to change
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 306
diff changeset
5306 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5307 return;
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5308 }
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5309 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5310 WinEnableWindow(handle, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5311 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5312
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5313 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5314 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5315 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5316 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5317 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5318 void API dw_window_enable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5319 {
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5320 ULONG fore = (ULONG)dw_window_get_data(handle, "_dw_fore");
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5321 ULONG back = (ULONG)dw_window_get_data(handle, "_dw_back");
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5322 HWND hwnd = _find_entryfield(handle);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5323
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5324 dw_window_set_data(handle, "_dw_disabled", 0);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5325 if(hwnd)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5326 dw_window_set_data(hwnd, "_dw_disabled", 0);
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5327 if(fore && back)
228
326e114923cf Deal with the enhanced window enable/disable with the new color code
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 225
diff changeset
5328 _dw_window_set_color(hwnd ? hwnd : handle, fore-1, back-1);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
5329 dw_signal_disconnect_by_data(handle, (void *)100);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5330 WinEnableWindow(handle, TRUE);
367
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5331 if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled"))
f19440c0ff71 Bitmap buttons now display properly when disabled. Also fixes to bitmap
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 366
diff changeset
5332 WinInvalidateRect(handle, NULL, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5333 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5334
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5335 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5336 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5337 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5338 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5339 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5340 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5341 HWND API dw_window_from_id(HWND handle, int id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5342 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5343 HENUM henum;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5344 HWND child;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5345 char tmpbuf[100];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5346
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5347 henum = WinBeginEnumWindows(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5348 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5349 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5350 int windowid = WinQueryWindowUShort(child, QWS_ID);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5351 HWND found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5352
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5353 WinQueryClassName(child, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5354
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5355 /* 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
5356 if(strncmp(tmpbuf, "#1", 3)==0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5357 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5358 return found;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5359
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5360 if(windowid && windowid == id)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5361 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5362 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5363 return child;
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 WinEndEnumWindows(henum);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5367 return NULLHANDLE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5368 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5369
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5370 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5371 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5372 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5373 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5374 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5375 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5376 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5377 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5378 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5379 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5380 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5381 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5382 {
462
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
5383 char *funcname = "dw_box_pack_end()";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5384
447
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5385 /*
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5386 * If you try and pack an item into itself VERY bad things can happen; like at least an
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5387 * infinite loop on GTK! Lets be safe!
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5388 */
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5389 if(box == item)
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5390 {
526
d3ce0afa6cf5 Remove extraneous arguments to dw_messagebox()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 523
diff changeset
5391 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!");
447
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5392 return;
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5393 }
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
5394
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5395 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5396 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5397 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5398 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5399 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5400 }
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5401 _dw_box_pack_end(box, item, width, height, hsize, vsize, pad, funcname);
462
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
5402 }
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
5403
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
5404 void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname)
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
5405 {
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
5406 Box *thisbox = WinQueryWindowPtr(box, QWP_USER);
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
5407
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5408 if(thisbox)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5409 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5410 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5411 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5412 char tmpbuf[100];
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
5413 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5414
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5415 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5416
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5417 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5418 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5419 tmpitem[z+1] = thisitem[z];
3
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 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5423
298
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
5424 if(vsize && !height)
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
5425 height = 1;
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
5426 if(hsize && !width)
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
5427 width = 1;
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
5428
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5429 if(strncmp(tmpbuf, "#1", 3)==0)
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5430 tmpitem[0].type = TYPEBOX;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5431 else
438
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
5432 {
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
5433 if ( width == 0 && hsize == FALSE )
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
5434 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
5435 if ( height == 0 && vsize == FALSE )
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
5436 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
5437
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5438 tmpitem[0].type = TYPEITEM;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5439 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5440
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5441 tmpitem[0].hwnd = item;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5442 tmpitem[0].origwidth = tmpitem[0].width = width;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5443 tmpitem[0].origheight = tmpitem[0].height = height;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5444 tmpitem[0].pad = pad;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5445 if(hsize)
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5446 tmpitem[0].hsize = SIZEEXPAND;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5447 else
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5448 tmpitem[0].hsize = SIZESTATIC;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5449
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5450 if(vsize)
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5451 tmpitem[0].vsize = SIZEEXPAND;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5452 else
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5453 tmpitem[0].vsize = SIZESTATIC;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5454
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5455 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5456
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5457 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5458 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5459
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5460 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5461
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5462 WinQueryClassName(item, 99, tmpbuf);
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
5463 /* Don't set the ownership if it's an entryfield or spinbutton */
408
fecd529ba9d4 Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 406
diff changeset
5464 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5465 WinSetOwner(item, box);
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
5466 WinSetParent(frame ? frame : item, box, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5467 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5468 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5469
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5470 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5471 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5472 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5473 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5474 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5475 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5476 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5477 void API dw_window_set_size(HWND handle, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5478 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5479 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5480 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5481
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5482 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5483 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5484 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5485 int API dw_screen_width(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5486 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5487 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5488 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5489
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5490 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5491 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5492 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5493 int API dw_screen_height(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5494 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5495 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5496 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5497
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5498 /* This should return the current color depth */
514
08d770271709 More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 513
diff changeset
5499 unsigned long API dw_color_depth_get(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5500 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5501 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5502 long colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5503
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5504 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5505 DevCloseDC(hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5506 return colors;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5507 }
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5511 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5512 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5513 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5514 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5515 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5516 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5517 void API dw_window_set_pos(HWND handle, ULONG x, ULONG y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5518 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5519 int myy = _get_frame_height(handle) - (y + _get_height(handle));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5520
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5521 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5522 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5523
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5524 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5525 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5526 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5527 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5528 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5529 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5530 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5531 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5532 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5533 void API dw_window_set_pos_size(HWND handle, ULONG x, ULONG y, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5534 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5535 int myy = _get_frame_height(handle) - (y + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5536
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5537 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5538 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5539
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5540 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5541 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5542 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5543 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5544 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5545 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5546 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5547 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5548 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5549 void API dw_window_get_pos_size(HWND handle, ULONG *x, ULONG *y, ULONG *width, ULONG *height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5550 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5551 SWP swp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5552 WinQueryWindowPos(handle, &swp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5553 if(x)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5554 *x = swp.x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5555 if(y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5556 *y = _get_frame_height(handle) - (swp.y + swp.cy);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5557 if(width)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5558 *width = swp.cx;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5559 if(height)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5560 *height = swp.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5561 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5562
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5563 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5564 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5565 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5566 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5567 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5568 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5569 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5570 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5571 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5572 WinSetWindowBits(handle, QWL_STYLE, style, mask);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5573 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5574
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5575 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5576 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5577 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5578 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5579 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5580 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5581 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5582 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5583 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5584 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
347
0137c30f485e Simplified dw_notebook_page_new code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 346
diff changeset
5585 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5586 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5587
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5588 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5589 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5590 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5591 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5592 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5593 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5594 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5595 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5596 WinSendMsg(handle, BKM_DELETEPAGE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5597 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5598 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5599
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5600 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5601 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5602 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5603 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5604 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5605 unsigned long API dw_notebook_page_get(HWND handle)
346
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
5606 {
81fae15885d7 Implemented switch-page on OS/2, and changed the signal prototype to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 342
diff changeset
5607 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5608 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5609
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5610 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5611 * Sets the currently visibale page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5612 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5613 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5614 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5615 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5616 void API dw_notebook_page_set(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5617 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5618 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5619 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5620
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5621 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5622 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5623 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5624 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5625 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5626 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5627 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5628 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5629 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5630 WinSendMsg(handle, BKM_SETTABTEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5631 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5632 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5633
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5634 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5635 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5636 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5637 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5638 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5639 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5640 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5641 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5642 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5643 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5644 MPFROMLONG(pageid), MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5645 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5646
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5647 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5648 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5649 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5650 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5651 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5652 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5653 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5654 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5655 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
5656 HWND tmpbox = dw_box_new(DW_VERT, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5657
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5658 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5659 WinSubclassWindow(tmpbox, _wndproc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5660 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5661 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5662 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5663
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5664 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5665 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5666 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5667 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5668 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5669 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5670 void API dw_listbox_append(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5671 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5672 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5673 LM_INSERTITEM,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5674 MPFROMSHORT(LIT_END),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5675 MPFROMP(text));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5676 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5677
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5678 /*
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5679 * Appends the specified text items to the listbox's (or combobox) entry list.
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5680 * Parameters:
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5681 * handle: Handle to the listbox to be appended to.
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5682 * text: Text strings to append into listbox.
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5683 * count: Number of text strings to append
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5684 */
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5685 void API dw_listbox_list_append(HWND handle, char **text, int count)
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5686 {
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5687 int i;
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5688 for(i=0;i<count;i++)
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5689 WinSendMsg(handle,
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5690 LM_INSERTITEM,
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5691 MPFROMSHORT(LIT_END),
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5692 MPFROMP(text[i]));
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5693 }
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5694
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
5695 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5696 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5697 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5698 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5699 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5700 void API dw_listbox_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5701 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5702 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5703 LM_DELETEALL, 0L, 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5704 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5705
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5706 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5707 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5708 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5709 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5710 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5711 int API dw_listbox_count(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5712 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5713 return (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5714 LM_QUERYITEMCOUNT,0L, 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5715 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5716
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5717 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5718 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5719 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5720 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5721 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5722 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5723 void API dw_listbox_set_top(HWND handle, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5724 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5725 WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5726 LM_SETTOPINDEX,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5727 MPFROMSHORT(top),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5728 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5729 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5730
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5731 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5732 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5733 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5734 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5735 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5736 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5737 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5738 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5739 void API dw_listbox_get_text(HWND handle, unsigned int index, char *buffer, unsigned int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5740 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5741 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5742 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5743
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5744 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5745 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5746 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5747 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5748 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5749 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5750 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5751 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5752 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5753 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5754 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5755
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5756 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5757 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5758 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5759 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5760 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5761 unsigned int API dw_listbox_selected(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5762 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5763 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
5764 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
5765 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
5766 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5767 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5768
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5769 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5770 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5771 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5772 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5773 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5774 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5775 int API dw_listbox_selected_multi(HWND handle, int where)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5776 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5777 int place = where;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5778
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5779 if(where == -1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5780 place = LIT_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5781
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5782 place = (int)WinSendMsg(handle,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5783 LM_QUERYSELECTION,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5784 MPFROMSHORT(place),0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5785 if(place == LIT_NONE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5786 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5787 return place;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5788 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5789
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5790 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5791 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5792 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5793 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5794 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5795 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5796 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5797 void API dw_listbox_select(HWND handle, int index, int state)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5798 {
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
5799 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
5800
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5801 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
5802
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5803 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
5804
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
5805 /* 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
5806 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
5807 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5808 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5809
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5810 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5811 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5812 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5813 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5814 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5815 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5816 void API dw_listbox_delete(HWND handle, int index)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5817 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5818 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5819 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5820
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5821 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5822 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5823 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5824 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5825 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5826 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5827 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5828 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5829 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5830 unsigned long point = startpoint;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5831 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5832
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5833 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5834 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5835 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5836 int amount, len = strlen(buffer), written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5837
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5838 while(written < len)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5839 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5840 if((len - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5841 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5842 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5843 amount = len - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5844
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5845 memcpy(mlebuf, &buffer[written], amount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5846 mlebuf[amount] = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5847
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5848 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5849 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(amount + 1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5850 dw_mle_delete(handle, point, 1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5851
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5852 written += amount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5853 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5854 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5855 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5856 return point - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5857 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5858
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5859 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5860 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5861 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5862 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5863 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5864 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5865 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5866 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5867 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5868 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5869 PBYTE mlebuf;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5870
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5871 /* Work around 64K limit */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5872 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5873 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5874 int amount, copied, written = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5875
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5876 while(written < length)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5877 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5878 if((length - written) > 65535)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5879 amount = 65535;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5880 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5881 amount = length - written;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5882
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5883 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5884 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5885
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5886 if(copied)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5887 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5888 memcpy(&buffer[written], mlebuf, copied);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5889
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5890 written += copied;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5891 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5892 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5893 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5894 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5895 DosFreeMem(mlebuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5896 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5897 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5898
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5899 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5900 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5901 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5902 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5903 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5904 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5905 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5906 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5907 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5908 if(bytes)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5909 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5910 if(lines)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5911 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5912 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5913
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5914 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5915 * Deletes text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5916 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5917 * handle: Handle to the MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5918 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5919 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5920 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5921 void API dw_mle_delete(HWND handle, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5922 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5923 char *buf = malloc(length+1);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5924 int z, dellen = length;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5925
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5926 dw_mle_export(handle, buf, startpoint, length);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5927
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5928 for(z=0;z<length-1;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5929 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5930 if(strncmp(&buf[z], "\r\n", 2) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5931 dellen--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5932 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5933 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(dellen));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5934 free(buf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5935 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5936
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5937 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5938 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5939 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5940 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5941 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5942 void API dw_mle_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5943 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5944 unsigned long bytes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5945
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5946 dw_mle_get_size(handle, &bytes, NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5947
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5948 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5949 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5950
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5951 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5952 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5953 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5954 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5955 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5956 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
5957 void API dw_mle_set_visible(HWND handle, int line)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5958 {
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
5959 int tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line), 0);
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
5960 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5961 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5962
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5963 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5964 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5965 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5966 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5967 * 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
5968 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
5969 void API dw_mle_set_editable(HWND handle, int state)
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5970 {
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5971 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0);
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5972 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5973
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5974 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5975 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5976 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5977 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5978 * 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
5979 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
5980 void API dw_mle_set_word_wrap(HWND handle, int state)
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5981 {
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
5982 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5983 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5984
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5985 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5986 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5987 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5988 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5989 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5990 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
5991 void API dw_mle_set_cursor(HWND handle, int point)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5992 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5993 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5994 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5995
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5996 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5997 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5998 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5999 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6000 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6001 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6002 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6003 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6004 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6005 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6006 MLE_SEARCHDATA msd;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6007
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
6008 /* 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
6009 * 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
6010 */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6011 msd.cb = sizeof(msd);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6012 msd.pchFind = text;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6013 msd.pchReplace = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6014 msd.cchFind = strlen(text);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6015 msd.cchReplace = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6016 msd.iptStart = point;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6017 msd.iptStop = -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6018
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6019 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6020 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6021 return 0;
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6025 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6026 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6027 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6028 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6029 void API dw_mle_freeze(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6030 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6031 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6032 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6033
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6034 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6035 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6036 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6037 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6038 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6039 void API dw_mle_thaw(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6040 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6041 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6042 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6043
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6044 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
6045 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6046 * 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
6047 * 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
6048 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6049 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6050 void API dw_percent_set_pos(HWND handle, unsigned int position)
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
6051 {
561
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6052 int range = _dw_percent_get_range(handle);
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6053 int mypos = ((float)position/100)*range;
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6054
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6055 if(range)
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6056 {
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6057 _dw_int_set(handle, mypos);
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6058 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)mypos);
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
6059 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6060 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6061
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6062 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6063 * 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
6064 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6065 * 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
6066 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6067 unsigned int API dw_slider_get_pos(HWND handle)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6068 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6069 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
6070 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6071
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6072 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6073 * 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
6074 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6075 * 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
6076 * 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
6077 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6078 void API dw_slider_set_pos(HWND handle, unsigned int position)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6079 {
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
6080 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
6081 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
6082 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6083
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
6084 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6085 * Returns the position of the scrollbar.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6086 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6087 * handle: Handle to the scrollbar to be queried.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6088 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6089 unsigned int API dw_scrollbar_get_pos(HWND handle)
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6090 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6091 return (unsigned int)WinSendMsg(handle, SBM_QUERYPOS, 0, 0);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6092 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6093
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6094 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6095 * Sets the scrollbar position.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6096 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6097 * handle: Handle to the scrollbar to be set.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6098 * position: Position of the scrollbar withing the range.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6099 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6100 void API dw_scrollbar_set_pos(HWND handle, unsigned int position)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6101 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6102 dw_window_set_data(handle, "_dw_scrollbar_value", (void *)position);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6103 WinSendMsg(handle, SBM_SETPOS, (MPARAM)position, 0);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6104 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6105
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6106 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6107 * Sets the scrollbar range.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6108 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6109 * handle: Handle to the scrollbar to be set.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6110 * range: Maximum range value.
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
6111 * visible: Visible area relative to the range.
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
6112 */
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
6113 void API dw_scrollbar_set_range(HWND handle, unsigned int range, unsigned int visible)
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6114 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6115 unsigned int pos = (unsigned int)dw_window_get_data(handle, "_dw_scrollbar_value");
203
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
6116 WinSendMsg(handle, SBM_SETSCROLLBAR, (MPARAM)pos, MPFROM2SHORT(0, (unsigned short)range - visible));
e0beea487e8f Added the basics for scrollbar thumb size on OS/2, and dw_main_iteration()
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 199
diff changeset
6117 WinSendMsg(handle, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)visible, range), 0);
212
f2d1e231922e Added code to deal with the PAGE and LINE messages for the scrollbars on
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 210
diff changeset
6118 dw_window_set_data(handle, "_dw_scrollbar_visible", (void *)visible);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6119 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6120
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
6121 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6122 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6123 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6124 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6125 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6126 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6127 void API dw_spinbutton_set_pos(HWND handle, long position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6128 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6129 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6130 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6131
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6132 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6133 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6134 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6135 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6136 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6137 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6138 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6139 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6140 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6141 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6142 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6143
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6144 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6145 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6146 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6147 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6148 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6149 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6150 void API dw_entryfield_set_limit(HWND handle, ULONG limit)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6151 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6152 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6153 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6154
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6155
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6156 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6157 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6158 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6159 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6160 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6161 long API dw_spinbutton_get_pos(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6162 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6163 long tmpval = 0L;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6164
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6165 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6166 return tmpval;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6167 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6168
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6169 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6170 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6171 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6172 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6173 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6174 int API dw_checkbox_get(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6175 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6176 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6177 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6178
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6179 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6180 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6181 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6182 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6183 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6184 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6185 void API dw_checkbox_set(HWND handle, int value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6186 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6187 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6188 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6189
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6190 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6191 * 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
6192 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6193 * 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
6194 * 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
6195 * 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
6196 * 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
6197 * 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
6198 * 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
6199 */
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6200 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, unsigned long icon, HTREEITEM parent, void *itemdata)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6201 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6202 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
6203 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
6204 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
6205
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6206 if(!item)
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6207 item = (HTREEITEM)CMA_FIRST;
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6208
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6209 /* 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
6210 * 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
6211 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6212
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6213 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
6214
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6215 /* 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
6216
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
6217 if((pci = (PCNRITEM)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1), 0)) == 0)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
6218 return 0;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6219
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6220 /* 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
6221
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6222 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
6223 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
6224 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
6225
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6226 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
6227 pci->user = itemdata;
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6228 pci->parent = parent;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6229
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6230 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
6231
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6232 ri.cb = sizeof(RECORDINSERT);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6233 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
6234 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
6235 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
6236 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
6237
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6238 /* 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
6239 * 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
6240 */
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6241 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
6242
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6243 /* 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
6244 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
6245
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6246 return (HTREEITEM)pci;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6247 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6248
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6249 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6250 * 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
6251 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6252 * 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
6253 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6254 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6255 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6256 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6257 */
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6258 HTREEITEM API dw_tree_insert(HWND handle, char *title, unsigned long icon, HTREEITEM parent, void *itemdata)
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6259 {
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6260 return dw_tree_insert_after(handle, (HTREEITEM)CMA_END, title, icon, parent, itemdata);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6261 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6262
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6263 /*
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
6264 * 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
6265 * 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
6266 * 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
6267 * 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
6268 * 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
6269 * 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
6270 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6271 void API dw_tree_item_change(HWND handle, HTREEITEM item, char *title, unsigned long icon)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6272 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6273 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
6274
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6275 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
6276 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
6277
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6278 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
6279 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
6280
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6281 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
6282 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
6283
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6284 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
6285
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6286 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
6287 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6288
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6289 /*
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6290 * Gets the text an item in a tree window (widget).
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6291 * Parameters:
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6292 * handle: Handle to the tree containing the item.
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6293 * item: Handle of the item to be modified.
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6294 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6295 char * API dw_tree_get_title(HWND handle, HTREEITEM item)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6296 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6297 PCNRITEM pci = (PCNRITEM)item;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6298
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6299 handle = handle; /* keep compiler happy */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6300 if(pci)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6301 return pci->rc.pszIcon;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6302 return NULL;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6303 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6304
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6305 /*
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6306 * Gets the text an item in a tree window (widget).
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6307 * Parameters:
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6308 * handle: Handle to the tree containing the item.
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6309 * item: Handle of the item to be modified.
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6310 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6311 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6312 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6313 PCNRITEM pci = (PCNRITEM)item;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6314
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6315 handle = handle; /* keep compiler happy */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6316 if(pci)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6317 return pci->parent;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6318 return (HTREEITEM)0;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6319 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6320
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
6321 /*
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
6322 * 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
6323 * 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
6324 * 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
6325 * 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
6326 * 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
6327 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
6328 void API dw_tree_item_set_data(HWND handle, HTREEITEM item, void *itemdata)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6329 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6330 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
6331
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
6332 handle = handle; /* keep compiler happy */
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6333 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
6334 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
6335
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6336 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
6337 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6338
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6339 /*
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6340 * Gets the item data of a tree item.
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6341 * Parameters:
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6342 * handle: Handle to the tree containing the item.
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6343 * item: Handle of the item to be modified.
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6344 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6345 void * API dw_tree_item_get_data(HWND handle, HTREEITEM item)
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6346 {
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6347 PCNRITEM pci = (PCNRITEM)item;
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6348
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
6349 handle = handle; /* keep compiler happy */
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6350 if(!pci)
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6351 return NULL;
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6352 return pci->user;
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6353 }
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6354
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
6355 /*
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
6356 * 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
6357 * 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
6358 * 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
6359 * 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
6360 */
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6361 void API dw_tree_item_select(HWND handle, HTREEITEM item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6362 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6363 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
6364
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6365 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
6366 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6367 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
6368 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
6369 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
6370 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6371 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
6372 lastitem = 0;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6373 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
6374 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6375
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6376 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6377 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6378 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6379 * 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
6380 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6381 void API dw_tree_clear(HWND handle)
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6382 {
290
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
6383 dw_container_clear(handle, TRUE);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6384 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6385
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6386 /*
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
6387 * 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
6388 * 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
6389 * 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
6390 * 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
6391 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6392 void API dw_tree_item_expand(HWND handle, HTREEITEM item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6393 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6394 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
6395 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6396
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6397 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6398 * 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
6399 * 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
6400 * 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
6401 * 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
6402 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6403 void API dw_tree_item_collapse(HWND handle, HTREEITEM item)
54
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6404 {
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6405 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
6406 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6407
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
6408 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6409 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6410 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6411 * 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
6412 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6413 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6414 void API dw_tree_item_delete(HWND handle, HTREEITEM item)
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6415 {
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6416 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
6417
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6418 if(!item)
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6419 return;
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6420
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6421 if(pci->rc.pszIcon)
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6422 {
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6423 free(pci->rc.pszIcon);
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6424 pci->rc.pszIcon = 0;
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
6425 }
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
6426
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6427 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
6428 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
6429
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6430 /* 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
6431 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
6432 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
6433 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
6434 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
6435 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6436
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6437 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6438 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6439 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6440 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6441 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6442 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6443 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6444 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6445 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6446 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6447 int API dw_container_setup(HWND handle, unsigned long *flags, char **titles, int count, int separator)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6448 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6449 PFIELDINFO details, first, left = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6450 FIELDINFOINSERT detin;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6451 CNRINFO cnri;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6452 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6453 ULONG size = sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6454 ULONG *offStruct = malloc(count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6455 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
6456 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
6457 ULONG *oldflags = blah ? blah->data : 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6458
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6459 if(!offStruct || !tempflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6460 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6461
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6462 memcpy(tempflags, flags, count * sizeof(ULONG));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6463 tempflags[count] = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6464
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
6465 blah->data = tempflags;
70
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
6466 blah->flags = separator;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6467
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6468 if(oldflags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6469 free(oldflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6470
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6471 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6472 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6473 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE));
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 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6477 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6478 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6479 offStruct[z] = size;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6480 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6481 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6482 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6483 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6484 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6485 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6486 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6487 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6488 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6489 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6490 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6491
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6492 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6493
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6494 if(!first)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6495 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6496 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6497 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6498 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6499
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6500 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6501 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6502 if(z==separator-1)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6503 left=details;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6504 details->cb = sizeof(FIELDINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6505 details->flData = flags[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6506 details->flTitle = CFA_FITITLEREADONLY;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6507 details->pTitleData = titles[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6508 details->offStruct = offStruct[z];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6509 details = details->pNextFieldInfo;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6510 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6511
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6512 detin.cb = sizeof(FIELDINFOINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6513 detin.fInvalidateFieldInfo = FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6514 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6515 detin.cFieldInfoInsert = (ULONG)count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6516
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6517 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6518
18
f1002d51d959 Fixed a container problem on OS/2 with separator set to 0.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 16
diff changeset
6519 if(count > separator && separator > 0)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6520 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6521 cnri.cb = sizeof(CNRINFO);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6522 cnri.pFieldInfoLast = left;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6523 cnri.xVertSplitbar = 150;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6524
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6525 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6526 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6527
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
6528 cnri.flWindowAttr = CV_DETAIL | CV_MINI | CA_DETAILSVIEWTITLES;
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
6529 cnri.slBitmapOrIcon.cx = 16;
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
6530 cnri.slBitmapOrIcon.cy = 16;
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
6531
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
6532 WinSendMsg(handle, CM_SETCNRINFO, &cnri, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON));
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
6533
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6534 free(offStruct);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6535 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6536 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6537
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6538 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6539 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6540 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6541 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6542 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6543 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6544 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6545 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6546 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6547 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6548 char **newtitles = malloc(sizeof(char *) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6549 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6550
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6551 newtitles[0] = "Icon";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6552 newtitles[1] = "Filename";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6553
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6554 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6555 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6556
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6557 memcpy(&newtitles[2], titles, sizeof(char *) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6558 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6559
103
babc1ea53d79 If dw_filesystem_setup is called with 0 additional columns then don't
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 97
diff changeset
6560 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6561
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6562 free(newtitles);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6563 free(newflags);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6564 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6565 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6566
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6567 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6568 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6569 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6570 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6571 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6572 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6573 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6574 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6575 unsigned long API dw_icon_load(unsigned long module, unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6576 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6577 return WinLoadPointer(HWND_DESKTOP,module,id);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6578 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6579
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6580 /*
257
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6581 * Obtains an icon from a file.
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6582 * Parameters:
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6583 * filename: Name of the file, omit extention to have
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6584 * DW pick the appropriate file extension.
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6585 * (ICO on OS/2 or Windows, XPM on Unix)
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6586 */
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6587 unsigned long API dw_icon_load_from_file(char *filename)
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6588 {
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6589 char *file = alloca(strlen(filename) + 5);
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6590
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6591 if(!file)
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6592 return 0;
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6593
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6594 strcpy(file, filename);
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6595
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6596 /* check if we can read from this file (it exists and read permission) */
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6597 if(access(file, 04) != 0)
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6598 {
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6599 /* Try with .bmp extention */
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6600 strcat(file, ".ico");
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6601 if(access(file, 04) != 0)
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6602 return 0;
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6603 }
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6604 return WinLoadFileIcon(file, FALSE);
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6605 }
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6606
9ea4ac9a097f Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 241
diff changeset
6607 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6608 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6609 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6610 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6611 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6612 void API dw_icon_free(unsigned long handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6613 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6614 WinDestroyPointer(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6615 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6616
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6617 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6618 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6619 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6620 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6621 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6622 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6623 void * API dw_container_alloc(HWND handle, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6624 {
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
6625 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
6626 ULONG *flags = wd ? wd->data : 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6627 int z, size = 0, totalsize, count = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6628 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
6629 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
6630 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
6631
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
6632 if(!flags || rowcount < 1)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6633 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6634
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6635 while(flags[count])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6636 count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6637
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6638 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6639 for(z=0;z<count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6640 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6641 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6642 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6643 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6644 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6645 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6646 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6647 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6648 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6649 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6650 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6651 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6652
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6653 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6654
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
6655 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
6656
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6657 if(!(blah = (void *)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount), 0)))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6658 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6659
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6660 temp = (PRECORDCORE)blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6661
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6662 for(z=0;z<rowcount;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6663 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6664 temp->cb = totalsize;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6665 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6666 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6667
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6668 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
6669
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6670 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
6671 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
6672 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
6673
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6674 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6676
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6677 /* Internal function that does the work for set_item and change_item */
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6678 void _dw_container_set_item(HWND handle, PRECORDCORE temp, int column, int row, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6679 {
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
6680 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
6681 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
6682 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
6683 CNRINFO cnr;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6684 void *dest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6685
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6686 if(!flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6687 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6688
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6689 if(!_dw_send_msg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0))
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6690 return;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6691
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6692 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
6693
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6694 /* Figure out the offsets to the items in the struct */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6695 for(z=0;z<column;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6696 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6697 if(flags[z] & DW_CFA_BITMAPORICON)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6698 size += sizeof(HPOINTER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6699 else if(flags[z] & DW_CFA_STRING)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6700 size += sizeof(char *);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6701 else if(flags[z] & DW_CFA_ULONG)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6702 size += sizeof(ULONG);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6703 else if(flags[z] & DW_CFA_DATE)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6704 size += sizeof(CDATE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6705 else if(flags[z] & DW_CFA_TIME)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6706 size += sizeof(CTIME);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6707 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6708
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6709 totalsize = size + sizeof(RECORDCORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6710
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6711 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6712 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6713
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6714 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6715
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6716 if(flags[column] & DW_CFA_BITMAPORICON)
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6717 memcpy(dest, data, sizeof(HPOINTER));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6718 else if(flags[column] & DW_CFA_STRING)
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6719 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6720 char **newstr = (char **)data, **str = dest;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6721
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6722 if(*str)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6723 free(*str);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6724
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6725 if(newstr && *newstr)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6726 *str = strdup(*newstr);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6727 else
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6728 *str = NULL;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6729 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6730 else if(flags[column] & DW_CFA_ULONG)
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6731 memcpy(dest, data, sizeof(ULONG));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6732 else if(flags[column] & DW_CFA_DATE)
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6733 memcpy(dest, data, sizeof(CDATE));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6734 else if(flags[column] & DW_CFA_TIME)
328
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6735 memcpy(dest, data, sizeof(CTIME));
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6736 }
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6737
e00aff2b899e Tree item handles are now of the type HTREEITEM instead of HWND since they
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 326
diff changeset
6738 /* Internal function that free()s any strings allocated for a container item */
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6739 void _dw_container_free_strings(HWND handle, PRECORDCORE temp)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6740 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6741 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6742 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6743 int z, count = 0;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6744
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6745 if(!flags)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6746 return;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6747
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6748 while(flags[count])
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6749 count++;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6750
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6751 /* Figure out the offsets to the items in the struct */
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6752 for(z=0;z<count;z++)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6753 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6754 if(flags[z] & DW_CFA_BITMAPORICON)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6755 size += sizeof(HPOINTER);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6756 else if(flags[z] & DW_CFA_STRING)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6757 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6758 char **str;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6759
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6760 totalsize = size + sizeof(RECORDCORE);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6761
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6762 str = (char **)(((ULONG)temp)+((ULONG)totalsize));
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6763
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6764 if(*str)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6765 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6766 free(*str);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6767 *str = NULL;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6768 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6769 size += sizeof(char *);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6770 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6771 else if(flags[z] & DW_CFA_ULONG)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6772 size += sizeof(ULONG);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6773 else if(flags[z] & DW_CFA_DATE)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6774 size += sizeof(CDATE);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6775 else if(flags[z] & DW_CFA_TIME)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6776 size += sizeof(CTIME);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6777 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6778 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6779
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6780 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6781 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6782 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6783 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6784 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6785 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6786 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6787 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6788 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6789 void API dw_container_set_item(HWND handle, void *pointer, int column, int row, void *data)
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6790 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6791 ContainerInfo *ci = (ContainerInfo *)pointer;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6792
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6793 if(!ci)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6794 return;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6795
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6796 _dw_container_set_item(handle, (PRECORDCORE)ci->data, column, row, data);
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6797 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6798
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6799 /*
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6800 * Changes an existing item in specified row and column to the given data.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6801 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6802 * handle: Handle to the container window (widget).
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6803 * column: Zero based column of data being set.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6804 * row: Zero based row of data being set.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6805 * data: Pointer to the data to be added.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6806 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6807 void API dw_container_change_item(HWND handle, int column, int row, void *data)
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6808 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6809 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6810 int count = 0;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6811
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6812 while(pCore)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6813 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6814 if(count == row)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6815 {
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6816 _dw_container_set_item(handle, pCore, column, 0, data);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6817 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED));
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6818 return;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6819 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6820 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6821 count++;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6822 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6823 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6824
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6825 /*
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6826 * Changes an existing item in specified row and column to the given data.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6827 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6828 * handle: Handle to the container window (widget).
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6829 * column: Zero based column of data being set.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6830 * row: Zero based row of data being set.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6831 * data: Pointer to the data to be added.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6832 */
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6833 void API dw_filesystem_change_item(HWND handle, int column, int row, void *data)
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6834 {
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6835 dw_container_change_item(handle, column + 2, row, data);
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6836 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6837
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6838 /*
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6839 * Changes an item in specified row and column to the given data.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6840 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6841 * handle: Handle to the container window (widget).
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6842 * pointer: Pointer to the allocated memory in dw_container_alloc().
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6843 * column: Zero based column of data being set.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6844 * row: Zero based row of data being set.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6845 * data: Pointer to the data to be added.
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6846 */
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6847 void API dw_filesystem_change_file(HWND handle, int row, char *filename, unsigned long icon)
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6848 {
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6849 dw_container_change_item(handle, 0, row, (void *)&icon);
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6850 dw_container_change_item(handle, 1, row, (void *)&filename);
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6851 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6852
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
6853 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6854 * Sets an item in specified row and column to the given data.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6855 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6856 * handle: Handle to the container window (widget).
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6857 * pointer: Pointer to the allocated memory in dw_container_alloc().
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6858 * column: Zero based column of data being set.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6859 * row: Zero based row of data being set.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6860 * data: Pointer to the data to be added.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
6861 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6862 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6863 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6864 dw_container_set_item(handle, pointer, 0, row, (void *)&icon);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6865 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6866 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6867
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6868 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6869 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6870 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6871 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6872 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6873 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6874 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6875 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6876 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6877 void API dw_filesystem_set_item(HWND handle, void *pointer, int column, int row, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6878 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6879 dw_container_set_item(handle, pointer, column + 2, row, data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6880 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6881
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6882 /*
508
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6883 * Gets column type for a container column
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6884 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6885 * handle: Handle to the container window (widget).
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6886 * column: Zero based column.
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6887 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6888 int API dw_container_get_column_type(HWND handle, int column)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6889 {
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6890 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6891 ULONG *flags = blah ? blah->data : 0;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6892 int rc;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6893
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6894 if(!flags)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6895 return 0;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6896
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6897 if(flags[column] & DW_CFA_BITMAPORICON)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6898 rc = DW_CFA_BITMAPORICON;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6899 else if(flags[column] & DW_CFA_STRING)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6900 rc = DW_CFA_STRING;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6901 else if(flags[column] & DW_CFA_ULONG)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6902 rc = DW_CFA_ULONG;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6903 else if(flags[column] & DW_CFA_DATE)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6904 rc = DW_CFA_DATE;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6905 else if(flags[column] & DW_CFA_TIME)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6906 rc = DW_CFA_TIME;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6907 else
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6908 rc = 0;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6909 return rc;
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6910 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6911
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6912 /*
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6913 * Gets column type for a filesystem container column
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6914 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6915 * handle: Handle to the container window (widget).
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6916 * column: Zero based column.
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6917 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6918 int API dw_filesystem_get_column_type(HWND handle, int column)
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6919 {
545
11e3d5e3543c COlumn offsets for filesystem containers in OS/2 is 2; not 1.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 543
diff changeset
6920 return dw_container_get_column_type( handle, column + 2 );
508
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6921 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6922
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
6923 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6924 * 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
6925 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6926 * 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
6927 * 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
6928 * 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
6929 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6930 void API dw_container_set_column_width(HWND handle, int column, int width)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6931 {
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
6932 handle = handle; /* keep compiler happy */
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
6933 column = column; /* keep compiler happy */
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
6934 width = width; /* keep compiler happy */
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6935 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6936
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6937 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6938 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6939 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6940 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6941 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6942 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6943 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6944 void API dw_container_set_row_title(void *pointer, int row, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6945 {
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6946 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
6947 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
6948 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
6949 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
6950
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6951 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6952 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6953
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
6954 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
6955
72
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
6956 z = 0;
ab77a22a2a36 Added localization APIs as well as some miscellaneous bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 70
diff changeset
6957
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6958 if(!_dw_send_msg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0))
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6959 return;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6960
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6961 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
6962
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
6963 for(z=0;z<(row-currentcount);z++)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6964 temp = temp->preccNextRecord;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6965
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6966 temp->pszIcon = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6967 temp->pszName = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6968 temp->pszText = title;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6969 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6970
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6971 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6972 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6973 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6974 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6975 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6976 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6977 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6978 void API dw_container_insert(HWND handle, void *pointer, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6979 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6980 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
6981 ContainerInfo *ci = (ContainerInfo *)pointer;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6982
23
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6983 if(!ci)
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6984 return;
2932f9d2c7d5 New OS/2 code from FX changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 22
diff changeset
6985
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6986 recin.cb = sizeof(RECORDINSERT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6987 recin.pRecordOrder = (PRECORDCORE)CMA_END;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6988 recin.pRecordParent = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6989 recin.zOrder = CMA_TOP;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6990 recin.fInvalidateRecord = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6991 recin.cRecordsInsert = rowcount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6992
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
6993 _dw_send_msg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin), 0);
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6994
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
6995 free(ci);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6996 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6997
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6998 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6999 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7000 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7001 * 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
7002 * 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
7003 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7004 void API dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7005 {
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7006 PCNRITEM pCore;
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7007 int container = (int)dw_window_get_data(handle, "_dw_container");
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
7008
315
89eac0990c67 Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 314
diff changeset
7009 if(hwndEmph == handle)
89eac0990c67 Safer container code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 314
diff changeset
7010 _clear_emphasis();
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7011
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7012 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7013
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7014 while(pCore)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7015 {
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7016 if(container)
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7017 _dw_container_free_strings(handle, (PRECORDCORE)pCore);
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7018 else
290
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7019 {
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7020 /* Free icon text */
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7021 if(pCore->rc.pszIcon)
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7022 {
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7023 free(pCore->rc.pszIcon);
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7024 pCore->rc.pszIcon = 0;
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7025 }
8ea5b2c35bfe Fixed tree memory leak on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 289
diff changeset
7026 }
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7027 pCore = (PCNRITEM)pCore->rc.preccNextRecord;/*WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));*/
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7028 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7029 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)0L, MPFROM2SHORT(0, (redraw ? CMA_INVALIDATE : 0) | CMA_FREE), -1);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7030 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7031
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7032 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7033 * 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
7034 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7035 * 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
7036 * 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
7037 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7038 void API dw_container_delete(HWND handle, int rowcount)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7039 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7040 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount);
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7041 int current = 1;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7042
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7043 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
7044
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7045 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
7046 {
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7047 _dw_container_free_strings(handle, last);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7048 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
7049 current++;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7050 }
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
7051
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
7052 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | CMA_FREE), -1);
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
7053
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7054 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
7055 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7056
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7057 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7058 * 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
7059 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7060 * 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
7061 * 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
7062 * 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
7063 * 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
7064 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7065 void API dw_container_scroll(HWND handle, int direction, long rows)
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7066 {
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
7067 rows = rows; /* keep compiler happy */
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7068 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
7069 {
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7070 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
7071 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
7072 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7073 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
7074 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
7075 break;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7076 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7077 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7078
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7079 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7080 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7081 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7082 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7083 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7084 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7085 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7086 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7087 char * API dw_container_query_start(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7088 {
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7089 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7090
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7091 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7092 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7093 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7094 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7095 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7096 {
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7097 if(pCore->flRecordAttr & flags)
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7098 {
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7099 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7100 return pCore->pszIcon;
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7101 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7102 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7103 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7104 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7105 else
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7106 {
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7107 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7108 return pCore->pszIcon;
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7109 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7110 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7111 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7112 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7113
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7114 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7115 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7116 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7117 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7118 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7119 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7120 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7121 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7122 char * API dw_container_query_next(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7123 {
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7124 PRECORDCORE pCore = (PRECORDCORE)dw_window_get_data(handle, "_dw_pcore");
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7125
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7126 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7127
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7128 if(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7129 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7130 if(flags)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7131 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7132 while(pCore)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7133 {
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7134 if(pCore->flRecordAttr & flags)
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7135 {
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7136 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7137 return pCore->pszIcon;
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7138 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7139
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7140 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7141 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7142 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7143 else
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7144 {
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7145 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7146 return pCore->pszIcon;
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7147 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7148 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7149 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7150 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7151
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7152 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7153 * 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
7154 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7155 * 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
7156 * 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
7157 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7158 void API dw_container_cursor(HWND handle, char *text)
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7159 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7160 RECTL viewport, item;
497
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7161 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
a7f478e9c20c No longer use global variables for dw_container_query*() so it can be
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 489
diff changeset
7162
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7163 while(pCore)
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7164 {
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
7165 if((char *)pCore->pszIcon == text)
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7166 {
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7167 QUERYRECORDRECT qrr;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7168 int scrollpixels = 0, midway;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7169
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7170 qrr.cb = sizeof(QUERYRECORDRECT);
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7171 qrr.pRecord = pCore;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7172 qrr.fRightSplitWindow = 0;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7173 qrr.fsExtent = CMA_TEXT;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7174
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7175 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
7176 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
7177 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
7178
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7179 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
7180 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
7181
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7182 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
7183 return;
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7184 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7185
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7186 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
7187 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7188 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7189
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7190 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7191 * Deletes the item with the text speficied.
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7192 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7193 * handle: Handle to the window (widget).
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7194 * text: Text usually returned by dw_container_query().
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7195 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7196 void API dw_container_delete_row(HWND handle, char *text)
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7197 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7198 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7199
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7200 while(pCore)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7201 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7202 if((char *)pCore->pszIcon == text)
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7203 {
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7204 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE));
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7205 return;
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7206 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7207 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7208 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7209 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7210
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7211 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7212 * 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
7213 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7214 * 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
7215 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7216 void API dw_container_optimize(HWND handle)
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7217 {
70
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7218 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
7219 RECTL item;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7220 PRECORDCORE pCore = NULL;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7221 int max = 0;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7222
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7223 if(blah && !blah->flags)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7224 return;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7225
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7226 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
7227 while(pCore)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7228 {
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7229 QUERYRECORDRECT qrr;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7230 int vector;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7231
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7232 qrr.cb = sizeof(QUERYRECORDRECT);
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7233 qrr.pRecord = pCore;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7234 qrr.fRightSplitWindow = 0;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7235 qrr.fsExtent = CMA_TEXT;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7236
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7237 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
7238
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7239 vector = item.xRight - item.xLeft;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7240
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7241 if(vector > max)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7242 max = vector;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7243
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7244 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
7245 }
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7246
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7247 if(max)
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7248 {
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7249 CNRINFO cnri;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7250
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7251 cnri.cb = sizeof(CNRINFO);
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7252 cnri.xVertSplitbar = max;
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7253
5e7a4d93d8d7 Implemented dw_container_optimize() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 69
diff changeset
7254 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
7255 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7256 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7257
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
7258 /*
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7259 * Inserts an icon into the taskbar.
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7260 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7261 * handle: Window handle that will handle taskbar icon messages.
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7262 * icon: Icon handle to display in the taskbar.
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7263 * bubbletext: Text to show when the mouse is above the icon.
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7264 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
7265 void API dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext)
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7266 {
489
bc156294dd16 Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 487
diff changeset
7267 handle = handle;
bc156294dd16 Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 487
diff changeset
7268 icon = icon;
bc156294dd16 Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 487
diff changeset
7269 bubbletext = bubbletext;
bc156294dd16 Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 487
diff changeset
7270 /* TODO */
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7271 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7272
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7273 /*
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7274 * Deletes an icon from the taskbar.
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7275 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7276 * handle: Window handle that was used with dw_taskbar_insert().
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7277 * icon: Icon handle that was used with dw_taskbar_insert().
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7278 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
7279 void API dw_taskbar_delete(HWND handle, unsigned long icon)
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7280 {
489
bc156294dd16 Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 487
diff changeset
7281 handle = handle;
bc156294dd16 Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 487
diff changeset
7282 icon = icon;
bc156294dd16 Fix compiler complaints on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 487
diff changeset
7283 /* TODO */
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7284 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7285
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
7286 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7287 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7288 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7289 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7290 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7291 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7292 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7293 HWND API dw_render_new(unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7294 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7295 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7296 WC_FRAME,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7297 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
7298 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
7299 FS_NOBYTEALIGN,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7300 0,0,2000,1000,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7301 NULLHANDLE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7302 HWND_TOP,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7303 id,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7304 NULL,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7305 NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7306 WinSubclassWindow(hwndframe, _RendProc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7307 return hwndframe;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7308 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7309
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7310 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7311 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7312 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7313 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7314 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7315 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7316 void API dw_color_foreground_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7317 {
192
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7318 _foreground = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7319 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7320
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7321 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7322 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7323 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7324 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7325 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7326 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7327 void API dw_color_background_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7328 {
192
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7329 _background = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7330 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7331
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7332 int DWSIGNAL _dw_color_cancel_func(HWND window, void *data)
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7333 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7334 DWDialog *dwwait = (DWDialog *)data;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7335 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7336 void *val;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7337
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7338 window = (HWND)dwwait->data;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7339 val = dw_window_get_data(window, "_dw_val");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7340
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7341 dw_mutex_lock(mtx);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7342 dw_mutex_close(mtx);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7343 dw_window_destroy(window);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7344 dw_dialog_dismiss((DWDialog *)data, val);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7345 return FALSE;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7346 }
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7347
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7348 int DWSIGNAL _dw_color_ok_func(HWND window, void *data)
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7349 {
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7350 DWDialog *dwwait = (DWDialog *)data;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7351 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7352 unsigned long val;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7353
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7354 window = (HWND)dwwait->data;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7355 val = _dw_color_spin_get(window);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7356
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7357 dw_mutex_lock(mtx);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7358 dw_mutex_close(mtx);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7359 dw_window_destroy(window);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7360 dw_dialog_dismiss((DWDialog *)data, (void *)val);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7361 return FALSE;
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7362 }
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7363
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7364 /* Allows the user to choose a color using the system's color chooser dialog.
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7365 * Parameters:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7366 * value: current color
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7367 * Returns:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7368 * The selected color or the current color if cancelled.
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7369 */
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7370 unsigned long API dw_color_choose(unsigned long value)
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7371 {
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7372 HWND window, hbox, vbox, col, button, text;
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7373 DWDialog *dwwait;
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7374 HMTX mtx = dw_mutex_new();
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7375
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7376 window = dw_window_new( HWND_DESKTOP, "Choose Color", FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7377
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7378 vbox = dw_box_new(DW_VERT, 5);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7379
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7380 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7381
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7382 hbox = dw_box_new(DW_HORZ, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7383
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7384 dw_box_pack_start(vbox, hbox, 0, 0, FALSE, FALSE, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7385 dw_window_set_style(hbox, 0, WS_CLIPCHILDREN);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7386
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7387 col = WinCreateWindow(vbox, "ColorSelectClass", "", WS_VISIBLE | WS_GROUP, 0, 0, 390, 300, vbox, HWND_TOP, 266, NULL,NULL);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7388 dw_box_pack_start(hbox, col, 390, 300, FALSE, FALSE, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7389
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7390 dw_window_set_data(hbox, "_dw_window", (void *)window);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7391 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7392 dw_window_set_data(window, "_dw_col", (void *)col);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7393 dw_window_set_data(window, "_dw_val", (void *)value);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7394
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7395 hbox = dw_box_new(DW_HORZ, 0);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7396 dw_window_set_data(hbox, "_dw_window", (void *)window);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7397
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7398 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7399
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7400 text = dw_text_new("Red:", 0);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7401 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7402 dw_box_pack_start(hbox, text, 30, 20, FALSE, FALSE, 3);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7403
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7404 button = dw_spinbutton_new("", 1001L);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7405 dw_spinbutton_set_limits(button, 255, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7406 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7407 WinSetOwner(button, hbox);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7408 dw_window_set_data(window, "_dw_red_spin", (void *)button);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7409
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7410 text = dw_text_new("Green:", 0);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7411 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7412 dw_box_pack_start(hbox, text, 30, 20, FALSE, FALSE, 3);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7413
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7414 button = dw_spinbutton_new("", 1002L);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7415 dw_spinbutton_set_limits(button, 255, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7416 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7417 WinSetOwner(button, hbox);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7418 dw_window_set_data(window, "_dw_green_spin", (void *)button);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7419
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7420 text = dw_text_new("Blue:", 0);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7421 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7422 dw_box_pack_start(hbox, text, 30, 20, FALSE, FALSE, 3);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7423
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7424 button = dw_spinbutton_new("", 1003L);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7425 dw_spinbutton_set_limits(button, 255, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7426 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7427 WinSetOwner(button, hbox);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7428 dw_window_set_data(window, "_dw_blue_spin", (void *)button);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7429
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7430 hbox = dw_box_new(DW_HORZ, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7431
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7432 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7433 dw_box_pack_start(hbox, 0, 100, 1, TRUE, FALSE, 0);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7434
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7435 button = dw_button_new("Ok", 1001L);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7436 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7437
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7438 dwwait = dw_dialog_new((void *)window);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7439
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7440 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_color_ok_func), (void *)dwwait);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7441
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7442 button = dw_button_new("Cancel", 1002L);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7443 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7444
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7445 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_color_cancel_func), (void *)dwwait);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7446 dw_signal_connect(window, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(_dw_color_cancel_func), (void *)dwwait);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7447
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7448 dw_window_set_size(window, 400, 400);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7449
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7450 _dw_col_set(col, value);
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
7451 _dw_color_spin_set(window, value);
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7452
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7453 dw_window_show(window);
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7454
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
7455 return (unsigned long)dw_dialog_wait(dwwait);
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7456 }
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
7457
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7458 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7459 {
225
413710a835eb Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 224
diff changeset
7460 LONG alTable[2];
413710a835eb Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 224
diff changeset
7461
413710a835eb Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 224
diff changeset
7462 alTable[0] = DW_RED_VALUE(_foreground) << 16 | DW_GREEN_VALUE(_foreground) << 8 | DW_BLUE_VALUE(_foreground);
413710a835eb Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 224
diff changeset
7463 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7464
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7465 GpiCreateLogColorTable(hps,
225
413710a835eb Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 224
diff changeset
7466 LCOL_RESET,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7467 LCOLF_CONSECRGB,
225
413710a835eb Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 224
diff changeset
7468 16,
413710a835eb Code cleanup in the test program, and fixed the color problem on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 224
diff changeset
7469 2,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7470 alTable);
192
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7471 if(_foreground & DW_RGB_COLOR)
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7472 GpiSetColor(hps, 16);
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7473 else
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7474 GpiSetColor(hps, _internal_color(_foreground));
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7475 if(_background & DW_RGB_COLOR)
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7476 GpiSetBackColor(hps, 17);
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7477 else
d946e329670c Added test application for OS/2, and allow dw_color_xxx_set() to use OS/2
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 190
diff changeset
7478 GpiSetBackColor(hps, _internal_color(_background));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7479 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7480 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7481
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7482 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7483 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7484 HPS hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7485
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7486 _set_hps(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7487 return hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7488 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7489
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7490 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7491 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7492 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7493 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7494 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7495 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7496 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7497 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7498 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7499 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7500 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7501 POINTL ptl;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7502
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7503 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7504 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7505 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7506 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7507 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7508 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7509 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7510 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7511 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7512 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7513 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7514 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7515
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7516 ptl.x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7517 ptl.y = height - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7518
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7519 GpiSetPel(hps, &ptl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7520 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7521 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7522 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7523
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7524 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7525 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7526 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7527 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7528 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7529 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7530 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7531 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7532 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7533 void API dw_draw_line(HWND handle, HPIXMAP pixmap, int x1, int y1, int x2, int y2)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7534 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7535 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7536 int height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7537 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7538
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7539 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7540 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7541 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7542 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7543 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7544 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7545 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7546 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7547 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7548 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7549 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7550 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7551
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7552 ptl[0].x = x1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7553 ptl[0].y = height - y1 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7554 ptl[1].x = x2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7555 ptl[1].y = height - y2 - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7556
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7557 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7558 GpiLine(hps, &ptl[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7559
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7560 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7561 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7562 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7563
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7564
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7565 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
7566 {
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7567 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
7568 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
7569 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
7570
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7571 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
7572
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7573 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
7574
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7575 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
7576 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
7577 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
7578
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7579 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
7580 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
7581
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7582 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
7583 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
7584 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
7585 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7586
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7587 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7588 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7589 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7590 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7591 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7592 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7593 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7594 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7595 void API dw_draw_text(HWND handle, HPIXMAP pixmap, int x, int y, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7596 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7597 HPS hps;
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
7598 int z, height;
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7599 RECTL rcl;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7600 char fontname[128];
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
7601 POINTL aptl[TXTBOX_COUNT];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7602
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7603 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7604 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7605 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7606 height = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7607 _GetPPFont(handle, fontname);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7608 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7609 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7610 {
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7611 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
7612
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7613 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7614 height = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7615 _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
7616 _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
7617 WinReleasePS(pixmaphps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7618 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7619 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7620 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7621
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7622 for(z=0;z<strlen(fontname);z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7623 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7624 if(fontname[z]=='.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7625 break;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7626 }
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
7627
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
7628 GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7629
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7630 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
7631 rcl.yTop = height - y;
220
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
7632 rcl.yBottom = rcl.yTop - (aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y);
d84054c1d587 Fixed a minor bug in dw_draw_text().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 212
diff changeset
7633 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x);
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
7634
376
b812cf360e49 dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 369
diff changeset
7635 if(_background == DW_CLR_DEFAULT)
b812cf360e49 dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 369
diff changeset
7636 WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS);
b812cf360e49 dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 369
diff changeset
7637 else
b812cf360e49 dw_draw_text() now draws the background color on OS/2 as well.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 369
diff changeset
7638 WinDrawText(hps, -1, text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7639
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7640 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7641 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7642 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7643
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
7644 /* 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
7645 * 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
7646 * 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
7647 * 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
7648 * 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
7649 * 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
7650 * 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
7651 */
514
08d770271709 More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 513
diff changeset
7652 void API dw_font_text_extents_get(HWND handle, HPIXMAP pixmap, char *text, int *width, int *height)
49
bf42d08d72d7 Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 47
diff changeset
7653 {
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
7654 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
7655 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
7656
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
7657 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
7658 {
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
7659 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
7660 }
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
7661 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
7662 {
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
7663 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
7664
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
7665 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
7666 _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
7667 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
7668 }
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
7669 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
7670 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
7671
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
7672 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
7673
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
7674 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
7675 *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
7676
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
7677 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
7678 *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
7679
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
7680 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
7681 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
7682 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7683
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7684 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7685 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7686 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7687 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7688 * fill: Fill box TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7689 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7690 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7691 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7692 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7693 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7694 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7695 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7696 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7697 int thisheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7698 POINTL ptl[2];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7699
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7700 if(handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7701 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7702 hps = _set_colors(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7703 thisheight = _get_height(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7704 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7705 else if(pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7706 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7707 hps = _set_hps(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7708 thisheight = pixmap->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7709 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7710 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7711 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7712
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7713 ptl[0].x = x;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7714 ptl[0].y = thisheight - y - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7715 ptl[1].x = x + width - 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7716 ptl[1].y = thisheight - y - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7717
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7718 GpiMove(hps, &ptl[0]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7719 GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7720
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7721 if(!pixmap)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7722 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7723 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7724
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7725 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7726 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7727 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7728 void API dw_flush(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7729 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7730 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7731
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7732 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7733 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7734 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7735 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7736 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7737 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7738 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7739 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7740 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7741 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7742 HPIXMAP API dw_pixmap_new(HWND handle, unsigned long width, unsigned long height, int depth)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7743 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7744 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7745 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7746 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7747 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7748 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7749 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7750 LONG cPlanes, cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7751
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7752 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7753 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7754
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7755 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7756
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7757 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7758 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7759
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7760 pixmap->handle = handle;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7761 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7762 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7763
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7764 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7765 if (!depth)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7766 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7767 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7768 depth = cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7769 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7770
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7771 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7772 bmih.cbFix = sizeof(BITMAPINFOHEADER);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7773 bmih.cx = (SHORT)width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7774 bmih.cy = (SHORT)height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7775 bmih.cPlanes = (SHORT)cPlanes;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7776 bmih.cBitCount = (SHORT)depth;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7777
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7778 pixmap->width = width; pixmap->height = height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7779
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7780 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7781
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7782 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7783
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7784 if (depth>8)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7785 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL );
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7786
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7787 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7788
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7789 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7790 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7791
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7792 /*
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7793 * Creates a pixmap from a file.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7794 * Parameters:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7795 * handle: Window handle the pixmap is associated with.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7796 * filename: Name of the file, omit extention to have
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7797 * DW pick the appropriate file extension.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7798 * (BMP on OS/2 or Windows, XPM on Unix)
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7799 * Returns:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7800 * A handle to a pixmap or NULL on failure.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7801 */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7802 HPIXMAP API dw_pixmap_new_from_file(HWND handle, char *filename)
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7803 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7804 HPIXMAP pixmap;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7805 char *file = alloca(strlen(filename) + 5);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7806
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7807 if(!file || !(pixmap = calloc(1,sizeof(struct _hpixmap))))
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7808 return NULL;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7809
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7810 strcpy(file, filename);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7811
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7812 /* check if we can read from this file (it exists and read permission) */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7813 if(access(file, 04) != 0)
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7814 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7815 /* Try with .bmp extention */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7816 strcat(file, ".bmp");
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7817 if(access(file, 04) != 0)
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7818 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7819 free(pixmap);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7820 return NULL;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7821 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7822 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7823
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
7824 /* Try to load the bitmap from file */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
7825 if(!_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height))
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7826 {
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7827 free(pixmap);
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7828 return NULL;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7829 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7830
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
7831 /* Success fill in other values */
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7832 pixmap->handle = handle;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7833
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7834 return pixmap;
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7835 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7836
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
7837 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7838 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7839 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7840 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7841 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7842 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7843 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7844 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7845 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7846 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7847 BITMAPINFOHEADER bmih;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7848 SIZEL sizl = { 0, 0 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7849 HPIXMAP pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7850 HDC hdc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7851 HPS hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7852 ULONG ulFlags;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7853
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7854 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7855 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7856
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7857 hps = WinGetPS(handle);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7858
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7859 hdc = GpiQueryDevice(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7860 ulFlags = GpiQueryPS(hps, &sizl);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7861
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7862 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7863 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7864
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7865 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7866
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7867 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7868
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7869 GpiSetBitmap(pixmap->hps, pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7870
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7871 pixmap->width = bmih.cx; pixmap->height = bmih.cy;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7872
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7873 WinReleasePS(hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7874
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7875 return pixmap;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7876 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7877
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7878 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7879 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7880 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7881 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7882 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7883 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7884 void API dw_pixmap_destroy(HPIXMAP pixmap)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7885 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7886 GpiSetBitmap(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7887 GpiDeleteBitmap(pixmap->hbm);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7888 GpiAssociate(pixmap->hps, NULLHANDLE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7889 GpiDestroyPS(pixmap->hps);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7890 DevCloseDC(pixmap->hdc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7891 free(pixmap);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7892 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7893
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7894 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7895 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7896 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7897 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7898 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7899 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7900 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7901 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7902 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7903 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7904 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7905 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7906 * ysrc: Y coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7907 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7908 void API dw_pixmap_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7909 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7910 HPS hpsdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7911 HPS hpssrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7912 POINTL ptl[4];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7913 int destheight, srcheight;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7914
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7915 if(dest)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7916 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7917 hpsdest = WinGetPS(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7918 destheight = _get_height(dest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7919 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7920 else if(destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7921 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7922 hpsdest = destp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7923 destheight = destp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7924 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7925 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7926 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7927
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7928 if(src)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7929 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7930 hpssrc = WinGetPS(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7931 srcheight = _get_height(src);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7932 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7933 else if(srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7934 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7935 hpssrc = srcp->hps;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7936 srcheight = srcp->height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7937 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7938 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7939 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7940 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7941 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7942 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7943 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7944
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7945 ptl[0].x = xdest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7946 ptl[0].y = (destheight - ydest) - height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7947 ptl[1].x = ptl[0].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7948 ptl[1].y = destheight - ydest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7949 ptl[2].x = xsrc;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7950 ptl[2].y = srcheight - (ysrc + height);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7951 ptl[3].x = ptl[2].x + width;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7952 ptl[3].y = ptl[2].y + height;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7953
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7954 GpiBitBlt(hpsdest, hpssrc, 4, ptl, ROP_SRCCOPY, BBO_IGNORE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7955
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7956 if(!destp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7957 WinReleasePS(hpsdest);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7958 if(!srcp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7959 WinReleasePS(hpssrc);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7960 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7961
527
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7962 /* Run DosBeep() in a separate thread so it doesn't block */
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7963 void _beepthread(void *data)
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7964 {
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7965 int *info = (int *)data;
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7966
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7967 if(data)
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7968 {
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7969 DosBeep(info[0], info[1]);
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7970 free(data);
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7971 }
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7972 }
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7973
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7974 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7975 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7976 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7977 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7978 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7979 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7980 void API dw_beep(int freq, int dur)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7981 {
527
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7982 int *info = malloc(sizeof(int) * 2);
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7983
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7984 if(info)
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7985 {
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7986 info[0] = freq;
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7987 info[1] = dur;
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7988
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7989 _beginthread(_beepthread, NULL, 100, (void *)info);
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
7990 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7991 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7992
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7993 /* Open a shared library and return a handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7994 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7995 * name: Base name of the shared library.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7996 * handle: Pointer to a module handle,
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7997 * will be filled in with the handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
7998 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7999 int API dw_module_load(char *name, HMOD *handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8000 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8001 char objnamebuf[300] = "";
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8002
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8003 return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8004 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8005
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8006 /* Queries the address of a symbol within open handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8007 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8008 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8009 * name: Name of the symbol you want the address of.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8010 * func: A pointer to a function pointer, to obtain
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8011 * the address.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8012 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8013 int API dw_module_symbol(HMOD handle, char *name, void**func)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8014 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8015 return DosQueryProcAddr(handle, 0, name, (PFN*)func);
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8016 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8017
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8018 /* Frees the shared library previously opened.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8019 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8020 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8021 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8022 int API dw_module_close(HMOD handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8023 {
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8024 DosFreeModule(handle);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
8025 return 0;
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8026 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
8027
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8028 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8029 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8030 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8031 HMTX API dw_mutex_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8032 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8033 HMTX mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8034
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8035 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8036 return mutex;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8037 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8038
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8039 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8040 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8041 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8042 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8043 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8044 void API dw_mutex_close(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8045 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8046 DosCloseMutexSem(mutex);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8047 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8048
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8049 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8050 * 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
8051 * 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
8052 * while blocking.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8053 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8054 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8055 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8056 void API dw_mutex_lock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8057 {
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8058 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
8059 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8060 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
8061
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8062 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
8063 {
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8064 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
8065 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
8066 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8067 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8068 else
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8069 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8070 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8071
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8072 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8073 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8074 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8075 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8076 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8077 void API dw_mutex_unlock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8078 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8079 DosReleaseMutexSem(mutex);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8080 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8081
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8082 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8083 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8084 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8085 HEV API dw_event_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8086 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8087 HEV blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8088
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8089 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8090 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8091
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8092 return blah;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8093 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8094
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8095 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8096 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8097 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8098 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8099 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8100 int API dw_event_reset(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8101 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8102 ULONG count;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8103
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8104 if(DosResetEventSem(eve, &count))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8105 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8106 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8107 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8108
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8109 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8110 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8111 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8112 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8113 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8114 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8115 int API dw_event_post(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8116 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8117 if(DosPostEventSem(eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8118 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8119 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8120 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8121
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8122
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8123 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8124 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8125 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8126 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8127 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8128 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8129 int API dw_event_wait(HEV eve, unsigned long timeout)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8130 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8131 int rc = DosWaitEventSem(eve, timeout);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8132 if(!rc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8133 return 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8134 if(rc == ERROR_TIMEOUT)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8135 return -1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8136 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8137 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8138
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8139 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8140 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8141 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8142 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8143 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8144 int API dw_event_close(HEV *eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8145 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8146 if(!eve || ~DosCloseEventSem(*eve))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8147 return FALSE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8148 return TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8150
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8151 /* Create a named event semaphore which can be
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8152 * opened from other processes.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8153 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8154 * eve: Pointer to an event handle to receive handle.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8155 * name: Name given to semaphore which can be opened
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8156 * by other processes.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8157 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8158 HEV API dw_named_event_new(char *name)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8159 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8160 char *semname = malloc(strlen(name)+8);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8161 HEV ev = 0;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8162
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8163 if(!semname)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8164 return 0;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8165
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8166 strcpy(semname, "\\sem32\\");
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8167 strcat(semname, name);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8168
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8169 DosCreateEventSem(semname, &ev, 0L, FALSE);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8170
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8171 free(semname);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8172 return ev;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8173 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8174
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8175 /* Open an already existing named event semaphore.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8176 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8177 * eve: Pointer to an event handle to receive handle.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8178 * name: Name given to semaphore which can be opened
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8179 * by other processes.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8180 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8181 HEV API dw_named_event_get(char *name)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8182 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8183 char *semname = malloc(strlen(name)+8);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8184 HEV ev;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8185
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8186 if(!semname)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8187 return 0;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8188
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8189 strcpy(semname, "\\sem32\\");
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8190 strcat(semname, name);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8191
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8192 DosOpenEventSem(semname, &ev);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8193
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8194 free(semname);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8195 return ev;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8196 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8197
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8198 /* Resets the event semaphore so threads who call wait
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8199 * on this semaphore will block.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8200 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8201 * eve: Handle to the semaphore obtained by
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8202 * an open or create call.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8203 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8204 int API dw_named_event_reset(HEV eve)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8205 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8206 ULONG count;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8207
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8208 return DosResetEventSem(eve, &count);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8209 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8210
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8211 /* Sets the posted state of an event semaphore, any threads
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8212 * waiting on the semaphore will no longer block.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8213 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8214 * eve: Handle to the semaphore obtained by
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8215 * an open or create call.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8216 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8217 int API dw_named_event_post(HEV eve)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8218 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8219 return DosPostEventSem(eve);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8220 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8221
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8222
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8223 /* Waits on the specified semaphore until it becomes
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8224 * posted, or returns immediately if it already is posted.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8225 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8226 * eve: Handle to the semaphore obtained by
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8227 * an open or create call.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8228 * timeout: Number of milliseconds before timing out
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8229 * or -1 if indefinite.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8230 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8231 int API dw_named_event_wait(HEV eve, unsigned long timeout)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8232 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8233 int rc;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8234
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8235 rc = DosWaitEventSem(eve, timeout);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8236 switch (rc)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8237 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8238 case ERROR_INVALID_HANDLE:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8239 rc = DW_ERROR_NON_INIT;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8240 break;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8241 case ERROR_NOT_ENOUGH_MEMORY:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8242 rc = DW_ERROR_NO_MEM;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8243 break;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8244 case ERROR_INTERRUPT:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8245 rc = DW_ERROR_INTERRUPT;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8246 break;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8247 case ERROR_TIMEOUT:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8248 rc = DW_ERROR_TIMEOUT;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8249 break;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8250 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8251
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8252 return rc;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8253 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8254
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8255 /* Release this semaphore, if there are no more open
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8256 * handles on this semaphore the semaphore will be destroyed.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8257 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8258 * eve: Handle to the semaphore obtained by
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8259 * an open or create call.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8260 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8261 int API dw_named_event_close(HEV eve)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8262 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8263 int rc;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8264
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8265 rc = DosCloseEventSem(eve);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8266 switch (rc)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8267 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8268 case ERROR_INVALID_HANDLE:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8269 rc = DW_ERROR_NON_INIT;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8270 break;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8271
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8272 case ERROR_SEM_BUSY:
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8273 rc = DW_ERROR_INTERRUPT;
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8274 break;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8275 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8276
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8277 return rc;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8278 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8279
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8280 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8281 * Allocates a shared memory region with a name.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8282 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8283 * handle: A pointer to receive a SHM identifier.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8284 * dest: A pointer to a pointer to receive the memory address.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8285 * size: Size in bytes of the shared memory region to allocate.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8286 * name: A string pointer to a unique memory name.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8287 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8288 HSHM API dw_named_memory_new(void **dest, int size, char *name)
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8289 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8290 char namebuf[1024];
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8291
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8292 sprintf(namebuf, "\\sharemem\\%s", name);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8293
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8294 if(DosAllocSharedMem((void *)dest, namebuf, size, PAG_COMMIT | PAG_WRITE | PAG_READ) != NO_ERROR)
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8295 return 0;
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8296
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8297 return 1;
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8298 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8299
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8300 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8301 * Aquires shared memory region with a name.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8302 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8303 * dest: A pointer to a pointer to receive the memory address.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8304 * size: Size in bytes of the shared memory region to requested.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8305 * name: A string pointer to a unique memory name.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8306 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8307 HSHM API dw_named_memory_get(void **dest, int size, char *name)
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8308 {
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8309 char namebuf[1024];
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8310
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8311 size = size;
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8312 sprintf(namebuf, "\\sharemem\\%s", name);
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8313
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8314 if(DosGetNamedSharedMem((void *)dest, namebuf, PAG_READ | PAG_WRITE) != NO_ERROR)
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8315 return 0;
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8316
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8317 return 1;
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8318 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8319
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8320 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8321 * Frees a shared memory region previously allocated.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8322 * Parameters:
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8323 * handle: Handle obtained from DB_named_memory_allocate.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8324 * ptr: The memory address aquired with DB_named_memory_allocate.
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8325 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8326 int API dw_named_memory_free(HSHM handle, void *ptr)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8327 {
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8328 handle = handle;
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
8329
557
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8330 if(DosFreeMem(ptr) != NO_ERROR)
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8331 return -1;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8332 return 0;
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8333 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
8334
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8335 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8336 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8337 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8338 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8339 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8340 HAB thishab = WinInitialize(0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8341 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
579
cea01bd2e0a7 Thread functions should use the API/DWSIGNAL calling conventions.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 574
diff changeset
8342 void (* API threadfunc)(void *) = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8343 void **tmp = (void **)data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8344
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
8345 threadfunc = (void (* API)(void *))tmp[0];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8346 threadfunc(tmp[1]);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8347
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8348 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8349
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8350 WinDestroyMsgQueue(thishmq);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8351 WinTerminate(thishab);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8352 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8353
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8354 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8355 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8356 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8357 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8358 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8359 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8360 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8361 DWTID API dw_thread_new(void *func, void *data, int stack)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8362 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8363 void **tmp = malloc(sizeof(void *) * 2);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8364
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8365 tmp[0] = func;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8366 tmp[1] = data;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8367
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8368 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8369 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8370
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8371 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8372 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8373 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8374 void API dw_thread_end(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8375 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8376 _endthread();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8377 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8378
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8379 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8380 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8381 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8382 DWTID API dw_thread_id(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8383 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8384 return (DWTID)_threadid;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8385 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8386
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8387 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8388 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8389 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8390 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8391 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8392 void API dw_exit(int exitcode)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8393 {
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
8394 /* Destroy the menu message window */
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
8395 dw_window_destroy(hwndApp);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
8396
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8397 /* In case we are in a signal handler, don't
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8398 * try to free memory that could possibly be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8399 * free()'d by the runtime already.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8400 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8401 Root = NULL;
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8402
567
81ca08481d49 Added the basics of the color chooser on OS/2. Needs some more logic to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 566
diff changeset
8403 DosFreeModule(wpconfig);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8404 exit(exitcode);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8405 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8406
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8407 /*
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8408 * Creates a splitbar window (widget) with given parameters.
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8409 * Parameters:
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
8410 * type: Value can be DW_VERT or DW_HORZ.
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8411 * topleft: Handle to the window to be top or left.
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8412 * bottomright: Handle to the window to be bottom or right.
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8413 * Returns:
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8414 * A handle to a splitbar window or NULL on failure.
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8415 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8416 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id)
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8417 {
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8418 HWND tmp = WinCreateWindow(HWND_OBJECT,
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8419 SplitbarClassName,
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8420 NULL,
137
6a18312049fd The splitbar needs to have the WS_CLIPCHILDREN style set.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 136
diff changeset
8421 WS_VISIBLE | WS_CLIPCHILDREN,
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8422 0,0,2000,1000,
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8423 NULLHANDLE,
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8424 HWND_TOP,
119
1cad81b7cc4c Implemented initial splitbar code on Unix. And made some fixes for
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 117
diff changeset
8425 id,
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8426 NULL,
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8427 NULL);
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8428 if(tmp)
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8429 {
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
8430 HWND tmpbox = dw_box_new(DW_VERT, 0);
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8431 float *percent = malloc(sizeof(float));
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8432
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8433 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0);
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8434 WinSetParent(tmpbox, tmp, FALSE);
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8435 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox);
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8436
283
54aafc134652 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 280
diff changeset
8437 tmpbox = dw_box_new(DW_VERT, 0);
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8438 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0);
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8439 WinSetParent(tmpbox, tmp, FALSE);
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8440 *percent = 50.0;
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8441 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox);
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8442 dw_window_set_data(tmp, "_dw_percent", (void *)percent);
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8443 dw_window_set_data(tmp, "_dw_type", (void *)type);
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8444 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8445 return tmp;
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8446 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8447
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8448 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8449 * Sets the position of a splitbar (pecentage).
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8450 * Parameters:
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8451 * handle: The handle to the splitbar returned by dw_splitbar_new().
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8452 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8453 void API dw_splitbar_set(HWND handle, float percent)
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8454 {
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8455 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent");
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
8456 int type = (int)dw_window_get_data(handle, "_dw_type");
129
e47c52b37cdd Code cleanup and OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 128
diff changeset
8457 unsigned long width, height;
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8458
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8459 if(mypercent)
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8460 *mypercent = percent;
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
8461
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
8462 dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
8463
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
8464 _handle_splitbar_resize(handle, percent, type, width, height);
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8465 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8466
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8467 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8468 * Gets the position of a splitbar (pecentage).
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8469 * Parameters:
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8470 * handle: The handle to the splitbar returned by dw_splitbar_new().
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
8471 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8472 float API dw_splitbar_get(HWND handle)
123
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8473 {
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8474 float *percent = (float *)dw_window_get_data(handle, "_dw_percent");
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8475
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8476 if(percent)
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8477 return *percent;
63f61a702b17 Updates to use floats to save the splitbar percentage.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 119
diff changeset
8478 return 0.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8479 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8480
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8481 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8482 * Pack windows (widgets) into a box from the start (or top).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8483 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8484 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8485 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8486 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8487 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8488 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8489 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8490 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8491 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8492 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8493 {
462
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8494 char *funcname = "dw_box_pack_start()";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8495
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8496 /*
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8497 * If you try and pack an item into itself VERY bad things can happen; like at least an
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8498 * infinite loop on GTK! Lets be safe!
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8499 */
447
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
8500 if(box == item)
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
8501 {
526
d3ce0afa6cf5 Remove extraneous arguments to dw_messagebox()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 523
diff changeset
8502 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!");
447
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
8503 return;
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
8504 }
5a0779561d0f Add more tests for dw_pac*() functions. Throw up a messagebox if you try and
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 438
diff changeset
8505
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8506 if(WinWindowFromID(box, FID_CLIENT))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8507 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8508 box = WinWindowFromID(box, FID_CLIENT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8509 hsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8510 vsize = TRUE;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8511 }
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8512 _dw_box_pack_start(box, item, width, height, hsize, vsize, pad, funcname);
462
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8513 }
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8514
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8515 void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname)
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8516 {
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8517 Box *thisbox = WinQueryWindowPtr(box, QWP_USER);
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8518
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8519 if(thisbox)
9d874ce0124a Removed obsolete code from dw_box_pack_* and from dw_file_browse().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 458
diff changeset
8520 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8521 int z;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8522 Item *tmpitem, *thisitem = thisbox->items;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8523 char tmpbuf[100];
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
8524 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8525
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8526 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8527
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8528 for(z=0;z<thisbox->count;z++)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8529 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8530 tmpitem[z] = thisitem[z];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8531 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8532
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8533 WinQueryClassName(item, 99, tmpbuf);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8534
298
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
8535 if(vsize && !height)
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
8536 height = 1;
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
8537 if(hsize && !width)
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
8538 width = 1;
caed245ea8a1 Sanity check, if expand is set width/height can't be zero... force it to 1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 293
diff changeset
8539
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
8540 if(strncmp(tmpbuf, "#1", 3)==0)
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8541 tmpitem[thisbox->count].type = TYPEBOX;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8542 else
438
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
8543 {
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
8544 if ( width == 0 && hsize == FALSE )
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
8545 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
8546 if ( height == 0 && vsize == FALSE )
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
8547 dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
fac2afe7bda3 Only throw up the messagebox when expand and size are both 0 and the item
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 429
diff changeset
8548
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8549 tmpitem[thisbox->count].type = TYPEITEM;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8550 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8551
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8552 tmpitem[thisbox->count].hwnd = item;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8553 tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8554 tmpitem[thisbox->count].origheight = tmpitem[thisbox->count].height = height;
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8555 tmpitem[thisbox->count].pad = pad;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8556 if(hsize)
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8557 tmpitem[thisbox->count].hsize = SIZEEXPAND;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8558 else
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8559 tmpitem[thisbox->count].hsize = SIZESTATIC;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8560
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8561 if(vsize)
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8562 tmpitem[thisbox->count].vsize = SIZEEXPAND;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8563 else
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8564 tmpitem[thisbox->count].vsize = SIZESTATIC;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8565
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8566 thisbox->items = tmpitem;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8567
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8568 if(thisbox->count)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8569 free(thisitem);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8570
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8571 thisbox->count++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8572
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
8573 /* Don't set the ownership if it's an entryfield or spinbutton */
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8574 WinQueryClassName(item, 99, tmpbuf);
408
fecd529ba9d4 Use dW_box_new() instead of WinCreateWindow() to make the container window
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 406
diff changeset
8575 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0)
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
8576 WinSetOwner(item, box);
405
4c084ec3e176 Ok, so that last fix has some problems, this new fix is a hybrid of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 404
diff changeset
8577 WinSetParent(frame ? frame : item, box, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8578 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8579 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8580
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8581 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8582 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8583 char* pchStart = pchBuffer;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8584 char* pchEnd = pchStart + ulSize - 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8585
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8586 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8587 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8588 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8589 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8590 *pchEnd-- = '\0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8591 while (pchEnd >= pchStart)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8592 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8593 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8594 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8595 ULONG ulMajor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8596 ULONG ulMinor = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8597
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8598 char* pch = pchEnd + 2;
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
8599 while (!isdigit ((int)*pch) && *pch)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8600 pch++;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8601
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
8602 while (isdigit ((int)*pch))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8603 ulMajor = ulMajor * 10 + *pch++ - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8604
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8605 if (*pch == '.')
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8606 {
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
8607 while (isdigit ((int)*++pch))
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8608 ulMinor = ulMinor * 10 + *pch - '0';
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8609 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8610 return ((ulMajor << 16) | ulMinor);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8611 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8612 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8613 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8614 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8615 pchEnd--;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8616 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8617 return (0);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8618 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8619
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8620 ULONG _GetSystemBuildLevel(void) {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8621 /* 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
8622 * 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
8623 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8624 ULONG ulBootDrive = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8625 ULONG ulBuild = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8626 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8627 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
8628 char achFileName[11] = "C:\\OS2KRNL";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8629 HFILE hfile;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8630 ULONG ulResult;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
8631
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
8632 achFileName[0] = (char)('A'+ulBootDrive-1);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
8633
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8634 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
8635 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8636 ULONG ulFileSize = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8637 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8638 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8639 const ULONG ulFirstTry = min (256, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8640 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8641 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8642 char *pchBuffer = malloc(ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8643 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8644 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8645 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8646 if (ulBuild == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8647 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8648 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8649 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8650 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8651 pchBuffer = malloc(ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8652
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8653 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8654 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8655 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8656 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8657 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8658 free(pchBuffer);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8659 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8660 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8661 DosClose (hfile);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8662 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8663 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8664 return (ulBuild);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8665 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8666
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
8667 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
8668 * 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
8669 * 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
8670 * 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
8671 * 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
8672 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8673 void API dw_window_default(HWND window, HWND defaultitem)
34
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
8674 {
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
8675 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
8676 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
8677
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
8678 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
8679 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
8680 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
8681
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
8682 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
8683 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
8684 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8685
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8686 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8687 * 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
8688 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8689 * 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
8690 * 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
8691 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8692 void API dw_window_click_default(HWND window, HWND next)
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8693 {
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8694 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
8695
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
8696 if(blah)
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8697 blah->clickdefault = next;
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8698 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8699
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
8700 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8701 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8702 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8703 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8704 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8705 void API dw_environment_query(DWEnv *env)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8706 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8707 ULONG Build;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8708
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8709 if(!env)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8710 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8711
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8712 /* The default is OS/2 2.0 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8713 strcpy(env->osName,"OS/2");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8714 env->MajorVersion = 2;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8715 env->MinorVersion = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8716
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8717 Build = _GetSystemBuildLevel();
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8718 env->MinorBuild = Build & 0xFFFF;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8719 env->MajorBuild = Build >> 16;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8720
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8721 if (aulBuffer[0] == 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8722 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8723 int i = (unsigned int)aulBuffer[1];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8724 if (i > 20)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8725 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8726 strcpy(env->osName,"Warp");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8727 env->MajorVersion = (int)i/10;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8728 env->MinorVersion = i-(((int)i/10)*10);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8729 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8730 else if (i == 10)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8731 env->MinorVersion = 1;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8732 }
15
81833f25b1aa Added new Dynamic Windows build information to the DWEnv struct.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 14
diff changeset
8733 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
8734 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
8735 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
8736 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
8737 env->DWSubVersion = DW_SUB_VERSION;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8738 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8739
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8740 /* The next few functions are support functions for the OS/2 folder browser */
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8741 void _populate_directory(HWND tree, HTREEITEM parent, char *path)
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8742 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8743 FILEFINDBUF3 ffbuf;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8744 HTREEITEM item;
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8745 ULONG count = 1;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8746 HDIR hdir = HDIR_CREATE;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8747
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8748 if(DosFindFirst(path, &hdir, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED | MUST_HAVE_DIRECTORY,
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8749 &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR)
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8750 {
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8751 while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR)
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8752 {
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8753 if(strcmp(ffbuf.achName, ".") && strcmp(ffbuf.achName, ".."))
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8754 {
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8755 int len = strlen(path);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8756 char *folder = malloc(len + ffbuf.cchName + 2);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8757 HTREEITEM tempitem;
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8758
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8759 strcpy(folder, path);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8760 strcpy(&folder[len-1], ffbuf.achName);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8761
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8762 item = dw_tree_insert(tree, ffbuf.achName, WinLoadFileIcon(folder, TRUE), parent, (void *)parent);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8763 tempitem = dw_tree_insert(tree, "", 0, item, 0);
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8764 dw_tree_item_set_data(tree, item, (void *)tempitem);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8765 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8766 }
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8767 DosFindClose(hdir);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8768 }
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8769 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8770
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8771 void _populate_tree_thread(void *data)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8772 {
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8773 HWND window = (HWND)data, tree = (HWND)dw_window_get_data(window, "_dw_tree");
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8774 HMTX mtx = (HMTX)dw_window_get_data(window, "_dw_mutex");
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8775 int drive;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8776 HTREEITEM items[26];
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8777 FSINFO volinfo;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8778
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8779 DosError(FERR_DISABLEHARDERR);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8780
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8781 dw_mutex_lock(mtx);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8782 for(drive=0;drive<26;drive++)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8783 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8784 if(DosQueryFSInfo(drive+1, FSIL_VOLSER,(PVOID)&volinfo, sizeof(FSINFO)) == NO_ERROR)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8785 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8786 char folder[5] = "C:\\", name[9] = "Drive C:";
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8787 HTREEITEM tempitem;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8788
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8789 folder[0] = name[6] = 'A' + drive;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8790
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8791 items[drive] = dw_tree_insert(tree, name, WinLoadFileIcon(folder, TRUE), NULL, 0);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8792 tempitem = dw_tree_insert(tree, "", 0, items[drive], 0);
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8793 dw_tree_item_set_data(tree, items[drive], (void *)tempitem);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8794 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8795 else
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8796 items[drive] = 0;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8797 }
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8798 dw_mutex_unlock(mtx);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8799
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8800 DosError(FERR_ENABLEHARDERR);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8801 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8802
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8803 int DWSIGNAL _dw_ok_func(HWND window, void *data)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8804 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8805 DWDialog *dwwait = (DWDialog *)data;
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8806 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8807 void *treedata;
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8808
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8809 window = window;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8810 if(!dwwait)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8811 return FALSE;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8812
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8813 dw_mutex_lock(mtx);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8814 treedata = dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected");
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8815 dw_mutex_close(mtx);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8816 dw_window_destroy((HWND)dwwait->data);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8817 dw_dialog_dismiss((DWDialog *)data, treedata);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8818 return FALSE;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8819 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8820
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8821 int DWSIGNAL _dw_cancel_func(HWND window, void *data)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8822 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8823 DWDialog *dwwait = (DWDialog *)data;
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8824 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8825
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8826 window = window;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8827 if(!dwwait)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8828 return FALSE;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8829
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8830 dw_mutex_lock(mtx);
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8831 dw_mutex_close(mtx);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8832 dw_window_destroy((HWND)dwwait->data);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8833 dw_dialog_dismiss((DWDialog *)data, NULL);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8834 return FALSE;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8835 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8836
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8837 char *_tree_folder(HWND tree, HTREEITEM item)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8838 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8839 char *folder=strdup("");
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8840 HTREEITEM parent = item;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8841
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8842 while(parent)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8843 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8844 char *temp, *text = dw_tree_get_title(tree, parent);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8845
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8846 if(text)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8847 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8848 if(strncmp(text, "Drive ", 6) == 0)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8849 text = &text[6];
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8850
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8851 temp = malloc(strlen(text) + strlen(folder) + 3);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8852 strcpy(temp, text);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8853 strcat(temp, "\\");
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8854 strcat(temp, folder);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8855 free(folder);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8856 folder = temp;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8857 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8858 parent = dw_tree_get_parent(tree, parent);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8859 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8860 return folder;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8861 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8862
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8863 int DWSIGNAL _item_select(HWND window, HTREEITEM item, char *text, void *data, void *itemdata)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8864 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8865 DWDialog *dwwait = (DWDialog *)data;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8866 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected");
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8867
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8868 text = text; itemdata = itemdata;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8869 if(treedata)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8870 free(treedata);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8871
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8872 treedata = _tree_folder(window, item);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8873 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8874
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8875 return FALSE;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8876 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8877
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8878 int DWSIGNAL _tree_expand(HWND window, HTREEITEM item, void *data)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8879 {
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8880 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(window, item);
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8881
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8882 data = data;
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8883 if(tempitem)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8884 {
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8885 char *folder = _tree_folder(window, item);
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8886
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
8887 dw_tree_item_set_data(window, item, 0);
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8888 dw_tree_item_delete(window, tempitem);
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8889
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8890 if(*folder)
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8891 {
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8892 strcat(folder, "*");
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8893 _populate_directory(window, item, folder);
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8894 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8895 free(folder);
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8896 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8897
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8898 return FALSE;
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8899 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8900
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8901 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8902 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8903 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8904 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8905 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8906 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8907 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8908 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8909 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8910 * the file path on success.
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8911 *
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8912 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8913 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8914 {
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8915 if(flags == DW_DIRECTORY_OPEN)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8916 {
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8917 HWND window, hbox, vbox, tree, button;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8918 DWDialog *dwwait;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8919 HMTX mtx = dw_mutex_new();
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8920
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8921 window = dw_window_new( HWND_DESKTOP, title, FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8922
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8923 vbox = dw_box_new(DW_VERT, 5);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8924
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8925 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8926
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8927 tree = dw_tree_new(60);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8928
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8929 dw_box_pack_start(vbox, tree, 1, 1, TRUE, TRUE, 0);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8930 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
485
469ff8133ed3 Simplified the folder browser on OS/2, following some Unix changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 478
diff changeset
8931 dw_window_set_data(window, "_dw_tree", (void *)tree);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8932
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8933 hbox = dw_box_new(DW_HORZ, 0);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8934
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8935 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8936
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8937 dwwait = dw_dialog_new((void *)window);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8938
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8939 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_item_select), (void *)dwwait);
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8940 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8941
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8942 button = dw_button_new("Ok", 1001L);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8943 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8944 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8945
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8946 button = dw_button_new("Cancel", 1002L);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8947 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8948 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait);
568
07c100ee783d The color selection dialog is now functional under OS/2 but it does not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 567
diff changeset
8949 dw_signal_connect(window, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8950
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
8951 dw_window_set_size(window, 225, 300);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8952 dw_window_show(window);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8953
478
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
8954 dw_thread_new((void *)_populate_tree_thread, (void *)window, 0xff);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8955 return (char *)dw_dialog_wait(dwwait);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8956 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8957 else
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8958 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8959 FILEDLG fild;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8960 HWND hwndFile;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8961 int len;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8962
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8963 if(defpath)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8964 strcpy(fild.szFullFile, defpath);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8965 else
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8966 strcpy(fild.szFullFile, "");
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8967
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8968 len = strlen(fild.szFullFile);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8969
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8970 if(len)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8971 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8972 if(fild.szFullFile[len-1] != '\\')
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8973 strcat(fild.szFullFile, "\\");
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8974 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8975 strcat(fild.szFullFile, "*");
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8976
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8977 if(ext)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8978 {
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8979 strcat(fild.szFullFile, ".");
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8980 strcat(fild.szFullFile, ext);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8981 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8982
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8983 memset(&fild, 0, sizeof(FILEDLG));
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8984 fild.cbSize = sizeof(FILEDLG);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8985 fild.fl = FDS_CENTER | FDS_OPEN_DIALOG;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8986 fild.pszTitle = title;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8987 fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open");
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8988 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8989
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8990 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8991 if(hwndFile)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8992 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8993 switch(fild.lReturn)
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8994 {
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8995 case DID_OK:
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8996 return strdup(fild.szFullFile);
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8997 case DID_CANCEL:
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8998 return NULL;
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
8999 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9000 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9001 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9002 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9003 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9004
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9005 /* Internal function to set drive and directory */
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9006 int _SetPath(char *path)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9007 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
9008 #ifndef __WATCOMC__
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9009 if(strlen(path) > 2)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9010 {
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9011 if(path[1] == ':')
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9012 {
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9013 char drive = toupper(path[0]);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9014 _chdrive((drive - 'A')+1);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9015 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9016 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
9017 #endif
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9018 return chdir(path);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9019 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9020
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9021 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9022 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9023 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9024 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9025 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9026 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9027 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9028 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9029 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9030 int API dw_exec(char *program, int type, char **params)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9031 {
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
9032 type = type; /* keep compiler happy */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
9033 return spawnvp(P_NOWAIT, program, (const char **)params);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9034 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9035
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9036 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9037 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9038 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9039 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9040 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9041 int API dw_browse(char *url)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9042 {
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9043 char *execargs[3], browser[1024], *olddir, *newurl = NULL;
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9044 int len, ret;
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9045
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9046 olddir = _getcwd(NULL, 1024);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9047
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9048 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS",
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9049 "DefaultWorkingDir", NULL, browser, 1024);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9050
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9051 if(browser[0])
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9052 _SetPath(browser);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9053
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9054 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS",
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9055 "DefaultBrowserExe", NULL, browser, 1024);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9056
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9057 len = strlen(browser) - strlen("explore.exe");
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9058
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9059 execargs[0] = browser;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9060 execargs[1] = url;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9061 execargs[2] = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9062
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9063 /* 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
9064 * 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
9065 */
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9066 if(len > 0)
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9067 {
356
fb2667339e9f Guess I should probably make sure they are trying to load a file
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 350
diff changeset
9068 if(stricmp(&browser[len], "explore.exe") == 0 && stricmp(url, "file://") == 0)
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9069 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9070 int newlen, z;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
9071 newurl = malloc(strlen(url) + 2);
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9072 sprintf(newurl, "file:///%s", &url[7]);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9073 newlen = strlen(newurl);
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9074 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
9075 {
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9076 if(newurl[z] == '|')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9077 newurl[z] = ':';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9078 if(newurl[z] == '/')
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9079 newurl[z] = '\\';
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9080 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9081 execargs[1] = newurl;
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9082 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9083 }
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
9084
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9085 ret = dw_exec(browser, DW_EXEC_GUI, execargs);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9086
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9087 if(olddir)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9088 {
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9089 _SetPath(olddir);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9090 free(olddir);
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9091 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
9092 if(newurl)
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
9093 free(newurl);
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
9094 return ret;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9095 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9096
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9097 /*
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9098 * Causes the embedded HTML widget to take action.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9099 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9100 * handle: Handle to the window.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9101 * action: One of the DW_HTML_* constants.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9102 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9103 void API dw_html_action(HWND handle, int action)
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9104 {
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9105 handle = handle;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9106 action = action;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9107 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9108
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9109 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9110 * Render raw HTML code in the embedded HTML widget..
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9111 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9112 * handle: Handle to the window.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9113 * string: String buffer containt HTML code to
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9114 * be rendered.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9115 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9116 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9117 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9118 int API dw_html_raw(HWND handle, char *string)
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9119 {
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9120 handle = handle;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9121 string = string;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9122 return -1;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9123 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9124
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9125 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9126 * Render file or web page in the embedded HTML widget..
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9127 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9128 * handle: Handle to the window.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9129 * url: Universal Resource Locator of the web or
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9130 * file object to be rendered.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9131 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9132 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9133 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9134 int API dw_html_url(HWND handle, char *url)
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9135 {
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9136 handle = handle;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9137 url = url;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9138 return -1;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9139 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9140
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9141 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9142 * Create a new Entryfield window (widget) to be packed.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9143 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9144 * text: The default text to be in the entryfield widget.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9145 * id: An ID to be used with dw_window_from_id() or 0L.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9146 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9147 HWND API dw_html_new(unsigned long id)
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9148 {
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9149 id = id;
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9150 return dw_box_new(DW_HORZ, 0);
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9151 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9152
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
9153 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9154 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9155 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9156 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9157 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9158 char * API dw_user_dir(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9159 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9160 static char _user_dir[1024] = "";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9161
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9162 if(!_user_dir[0])
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9163 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9164 char *home = getenv("HOME");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9165
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9166 if(home)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9167 strcpy(_user_dir, home);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9168 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9169 strcpy(_user_dir, "C:\\");
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9170 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9171 return _user_dir;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9172 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9173
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9174 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9175 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9176 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9177 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9178 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9179 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9180 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9181 void API dw_window_function(HWND handle, void *function, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9182 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9183 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9184 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9185
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9186 /* 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
9187 * 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
9188 * 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
9189 */
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9190 UserData *_find_userdata(UserData **root, char *varname)
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9191 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9192 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
9193
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9194 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
9195 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9196 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
9197 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
9198 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
9199 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9200 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
9201 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9202
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9203 int _new_userdata(UserData **root, char *varname, void *data)
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9204 {
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9205 UserData *new = _find_userdata(root, varname);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9206
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9207 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
9208 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9209 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
9210 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
9211 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9212 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9213 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9214 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
9215 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
9216 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9217 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
9218 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
9219
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9220 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
9221
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9222 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
9223 *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
9224 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9225 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9226 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
9227 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
9228 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9229 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
9230 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
9231 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9232 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
9233 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
9234 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9235 *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
9236 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9237 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
9238 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9239 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9240 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
9241 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9242
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9243 int _remove_userdata(UserData **root, char *varname, int all)
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9244 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9245 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
9246
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9247 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
9248 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9249 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
9250 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9251 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
9252 {
147
b479002e013f Upped the DW revision to 1.0, and merged with the latest code in the FX
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 137
diff changeset
9253 *root = tmp->next;
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9254 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
9255 free(tmp);
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9256 if(!all)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9257 return 0;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9258 tmp = *root;
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9259 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9260 else
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9261 {
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9262 /* If all is true we should
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9263 * never get here.
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9264 */
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9265 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
9266 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
9267 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
9268 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
9269 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9270 }
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9271 else
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9272 {
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9273 prev = tmp;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9274 tmp = tmp->next;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9275 }
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9276 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9277 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
9278 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9279
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9280 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9281 * 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
9282 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9283 * 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
9284 * 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
9285 * 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
9286 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9287 void API dw_window_set_data(HWND window, char *dataname, void *data)
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9288 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9289 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
9290
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9291 if(!blah)
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9292 {
180
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9293 if(!dataname)
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9294 return;
4207e64d4689 Fixing leaks on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 178
diff changeset
9295
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9296 blah = calloc(1, sizeof(WindowData));
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9297 WinSetWindowPtr(window, QWP_USER, blah);
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9298 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9299
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9300 if(data)
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9301 _new_userdata(&(blah->root), dataname, data);
117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9302 else
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9303 {
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
9304 if(dataname)
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9305 _remove_userdata(&(blah->root), dataname, FALSE);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9306 else
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9307 _remove_userdata(&(blah->root), NULL, TRUE);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9308 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9309 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9310
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9311 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9312 * 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
9313 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9314 * 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
9315 * 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
9316 * 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
9317 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
9318 void * API dw_window_get_data(HWND window, char *dataname)
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9319 {
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9320 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
9321
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9322 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
9323 {
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
9324 UserData *ud = _find_userdata(&(blah->root), dataname);
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9325 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
9326 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
9327 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9328 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
9329 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
9330
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9331 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9332 * Add a callback to a timer event.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9333 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9334 * interval: Milliseconds to delay between calls.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9335 * sigfunc: The pointer to the function to be used as the callback.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9336 * data: User data to be passed to the handler function.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9337 * Returns:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9338 * Timer ID for use with dw_timer_disconnect(), 0 on error.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9339 */
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9340 int API dw_timer_connect(int interval, void *sigfunc, void *data)
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9341 {
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9342 if(sigfunc)
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9343 {
289
0e6f09149eaa Fixed some EMX warnings.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 283
diff changeset
9344 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval);
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9345
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9346 if(timerid)
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9347 {
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9348 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data);
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9349 return timerid;
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9350 }
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9351 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9352 return 0;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9353 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9354
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9355 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9356 * Removes timer callback.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9357 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9358 * id: Timer ID returned by dw_timer_connect().
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9359 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9360 void API dw_timer_disconnect(int id)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9361 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9362 SignalHandler *prev = NULL, *tmp = Root;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9363
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9364 /* 0 is an invalid timer ID */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9365 if(!id)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9366 return;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9367
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9368 WinStopTimer(dwhab, NULLHANDLE, id);
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
9369
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9370 while(tmp)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9371 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9372 if(tmp->id == id)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9373 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9374 if(prev)
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9375 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9376 prev->next = tmp->next;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9377 free(tmp);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9378 tmp = prev->next;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9379 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9380 else
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9381 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9382 Root = tmp->next;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9383 free(tmp);
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9384 tmp = Root;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9385 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9386 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9387 else
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9388 {
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9389 prev = tmp;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9390 tmp = tmp->next;
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9391 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9392 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9393 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9394
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9395 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9396 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9397 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9398 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9399 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9400 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9401 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9402 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9403 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9404 {
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9405 ULONG message = 0, id = 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9406
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9407 if(window && signame && sigfunc)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9408 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9409 if((message = _findsigmessage(signame)) != 0)
465
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9410 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9411 /* Handle special case of the menu item */
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9412 if(message == WM_COMMAND && window < 65536)
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9413 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9414 char buffer[15];
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9415 HWND owner;
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9416
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9417 sprintf(buffer, "_dw_id%d", (int)window);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9418 owner = (HWND)dw_window_get_data(hwndApp, buffer);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9419
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9420 if(owner)
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9421 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9422 id = window;
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9423 window = owner;
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9424 dw_window_set_data(hwndApp, buffer, 0);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9425 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9426 else
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9427 {
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9428 /* If it is a popup menu clear all entries */
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9429 dw_signal_disconnect_by_window(window);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9430 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9431 }
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9432 _new_signal(message, window, id, sigfunc, data);
4ff2c7210973 Menu item handlers are now window local, ID is still used but it is local
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 462
diff changeset
9433 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9434 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9435 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9436
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9437 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9438 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9439 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9440 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9441 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9442 void API dw_signal_disconnect_by_name(HWND window, char *signame)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9443 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9444 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9445 ULONG message;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9446
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9447 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9448 return;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9449
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9450 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9451 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9452 if(tmp->window == window && tmp->message == message)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9453 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9454 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9455 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9456 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9457 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9458 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9459 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9460 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9461 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9462 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9463 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9464 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9465 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9466 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9467 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9468 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9469 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9470 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9471 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9472 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9473 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9474
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9475 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9476 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9477 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9478 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9479 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9480 void API dw_signal_disconnect_by_window(HWND window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9481 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9482 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9483
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9484 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9485 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9486 if(tmp->window == window)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9487 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9488 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9489 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9490 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9491 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9492 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9493 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9494 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9495 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9496 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9497 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9498 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9499 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9500 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9501 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9502 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9503 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9504 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9505 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9506 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9507 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9508
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9509 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9510 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9511 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9512 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9513 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9514 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9515 void API dw_signal_disconnect_by_data(HWND window, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9516 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9517 SignalHandler *prev = NULL, *tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9518
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9519 while(tmp)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9520 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9521 if(tmp->window == window && tmp->data == data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9522 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9523 if(prev)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9524 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9525 prev->next = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9526 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9527 tmp = prev->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9528 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9529 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9530 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9531 Root = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9532 free(tmp);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9533 tmp = Root;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9534 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9535 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9536 else
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9537 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9538 prev = tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9539 tmp = tmp->next;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9540 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9541 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9542 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9543
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
9544
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9545
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9546 /*
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9547 * Create a new static text window (widget) to be packed.
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9548 * **** temporary calendar *****
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9549 * Parameters:
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9550 * text: The text to be display by the static text widget.
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9551 * id: An ID to be used with dw_window_from_id() or 0L.
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9552 */
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9553 HWND API dw_calendar_new(ULONG id)
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9554 {
607
b4cb30f47a97 dw_calendar_set_date() sets the text of the dummy calendar
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 594
diff changeset
9555 char *text = "dummy calendar";
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9556 WindowData *blah = calloc(sizeof(WindowData), 1);
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9557 HWND tmp = WinCreateWindow(HWND_OBJECT,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9558 WC_STATIC,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9559 text,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9560 WS_VISIBLE | SS_TEXT,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9561 0,0,2000,1000,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9562 NULLHANDLE,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9563 HWND_TOP,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9564 id,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9565 NULL,
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9566 NULL);
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9567 blah->oldproc = WinSubclassWindow(tmp, _textproc);
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9568 WinSetWindowPtr(tmp, QWP_USER, blah);
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9569 dw_window_set_font(tmp, DefaultFont);
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9570 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
607
b4cb30f47a97 dw_calendar_set_date() sets the text of the dummy calendar
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 594
diff changeset
9571 WinSetWindowText(tmp, text);
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9572 return tmp;
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9573 }
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9574
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9575 void API dw_calendar_set_date( HWND window, int year, int month, int day )
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9576 {
607
b4cb30f47a97 dw_calendar_set_date() sets the text of the dummy calendar
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 594
diff changeset
9577 char tmp[30];
b4cb30f47a97 dw_calendar_set_date() sets the text of the dummy calendar
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 594
diff changeset
9578 sprintf( tmp, "%4.4d-%2.2d-%2.2d", year, month, day);
b4cb30f47a97 dw_calendar_set_date() sets the text of the dummy calendar
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 594
diff changeset
9579 WinSetWindowText(window, tmp);
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9580 }
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9581 void API dw_calendar_get_date( HWND window, int *year, int *month, int *day )
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9582 {
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9583 *year = *month = *day = 0;
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
9584 }