annotate os2/dw.c @ 1392:943266c86aed

Refactoring OS/2 and Windows code... eliminating BubbleButton... BubbleButton was no longer really used in Windows since I switched to native tooltips... However parts of it were still hanging around. Merging BubbleButton into WindowData on OS/2 to prepare for generic tooltip support. More coming very soon.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 26 Nov 2011 22:47:20 +0000
parents 0512fbb08abf
children eb83c9830dfa
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 *
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
5 * (C) 2000-2011 Brian Smith <brian@dbsoft.org>
1386
fd1de4e9e542 Updated the readme and comments in the source files
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1384
diff changeset
6 * (C) 2003-2011 Mark Hessling <mark@rexx.org>
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
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
16 #define INCL_DEV
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
17 #define INCL_SPL
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
18 #define INCL_SPLDOSPRINT
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
19 #define INCL_SPLERRORS
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
20
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
21 #include <os2.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
22 #include <stdlib.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
23 #include <string.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
24 #include <stdio.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
25 #include <stdarg.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
26 #include <stddef.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
27 #include <ctype.h>
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
28 #include <process.h>
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
29 #include <time.h>
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
30 #include <io.h>
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
31 #include <math.h>
171
b8e93557b2c7 EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 170
diff changeset
32 #ifndef __EMX__
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
33 #include <direct.h>
171
b8e93557b2c7 EMX does not have dirent.h.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 170
diff changeset
34 #endif
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
35 #include <sys/time.h>
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
36 #include <sys/stat.h>
1364
417866ad960b Fixes for compiling with Watcom on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1361
diff changeset
37 #ifdef __WATCOMC__
417866ad960b Fixes for compiling with Watcom on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1361
diff changeset
38 #include <alloca.h>
417866ad960b Fixes for compiling with Watcom on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1361
diff changeset
39 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
40 #include "dw.h"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
41
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
42 #define QWP_USER 0
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
43
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
44 /* 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
45 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
46
1382
3eedfd4f7c5d Bleah.. VAC doesn't have MAX_PATH... define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1381
diff changeset
47 #ifndef MAX_PATH
3eedfd4f7c5d Bleah.. VAC doesn't have MAX_PATH... define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1381
diff changeset
48 #define MAX_PATH 260
3eedfd4f7c5d Bleah.. VAC doesn't have MAX_PATH... define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1381
diff changeset
49 #endif
3eedfd4f7c5d Bleah.. VAC doesn't have MAX_PATH... define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1381
diff changeset
50
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
51 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
52 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
53 MRESULT EXPENTRY _scrollwndproc(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
54 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
55 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
56 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
57 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
58 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
59 void _free_menu_data(HWND menu);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
60 ULONG (* _System _PmPrintfString)(char *String) = 0;
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
61
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
62 char ClassName[] = "dynamicwindows";
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
63 char SplitbarClassName[] = "dwsplitbar";
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
64 char ScrollClassName[] = "dwscroll";
360
cf66410d03b4 Use 8.Helv as the default font before Warp 4.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 356
diff changeset
65 char *DefaultFont = "9.WarpSans";
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
66
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
67 HAB dwhab = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
68 HMQ dwhmq = 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
69 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
70 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
71
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
72 HWND hwndApp = NULLHANDLE, hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE;
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
73 HWND hwndTrayServer = NULLHANDLE, hwndTaskBar = NULLHANDLE;
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
74
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
75 PRECORDCORE pCoreEmph = NULL;
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
76 ULONG aulBuffer[4];
190
f4c9fa77136a A cleaner way of finding the toplevel window.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 185
diff changeset
77 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
78 HMOD wpconfig = 0, pmprintf = 0;
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
79 static char _dw_exec_dir[MAX_PATH+1] = {0};
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
80
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
81 unsigned long _colors[] = {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
82 CLR_BLACK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
83 CLR_DARKRED,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
84 CLR_DARKGREEN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
85 CLR_BROWN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
86 CLR_DARKBLUE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
87 CLR_DARKPINK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
88 CLR_DARKCYAN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
89 CLR_PALEGRAY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
90 CLR_DARKGRAY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
91 CLR_RED,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
92 CLR_GREEN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
93 CLR_YELLOW,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
94 CLR_BLUE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
95 CLR_PINK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
96 CLR_CYAN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
97 CLR_WHITE
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
98 };
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
99
20
38295c8d06d5 Added notebook, Warp 3 and WebExplorer fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 18
diff changeset
100 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
101
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
102 #ifndef min
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
103 #define min(a, b) (((a < b) ? a : b))
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
104 #endif
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
105
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
106 typedef struct _sighandler
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
107 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
108 struct _sighandler *next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
109 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
110 HWND window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
111 int id;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
112 void *signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
113 void *data;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
114
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
115 } SignalHandler;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
116
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
117 SignalHandler *Root = NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
118
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
119 typedef struct
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
120 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
121 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
122 char name[30];
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
123
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
124 } SignalList;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
125
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
126 /* 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
127 #define SIGNALMAX 16
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
128
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
129 SignalList SignalTranslate[SIGNALMAX] = {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
130 { WM_SIZE, DW_SIGNAL_CONFIGURE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
131 { WM_CHAR, DW_SIGNAL_KEY_PRESS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
132 { WM_BUTTON1DOWN, DW_SIGNAL_BUTTON_PRESS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
133 { WM_BUTTON1UP, DW_SIGNAL_BUTTON_RELEASE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
134 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
135 { WM_CLOSE, DW_SIGNAL_DELETE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
136 { WM_PAINT, DW_SIGNAL_EXPOSE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
137 { WM_COMMAND, DW_SIGNAL_CLICKED },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
138 { CN_ENTER, DW_SIGNAL_ITEM_ENTER },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
139 { CN_CONTEXTMENU, DW_SIGNAL_ITEM_CONTEXT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
140 { LN_SELECT, DW_SIGNAL_LIST_SELECT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
141 { CN_EMPHASIS, DW_SIGNAL_ITEM_SELECT },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
142 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
143 { SLN_SLIDERTRACK, DW_SIGNAL_VALUE_CHANGED },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
144 { BKN_PAGESELECTED,DW_SIGNAL_SWITCH_PAGE },
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
145 { CN_EXPANDTREE, DW_SIGNAL_TREE_EXPAND }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
146 };
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
147
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
148 /* Internal function to keep a semi-unique ID within valid range */
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
149 USHORT _GlobalID(void)
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
150 {
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
151 static USHORT GlobalID = 9999;
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
152
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
153 GlobalID++;
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
154 if(GlobalID >= 65534)
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
155 {
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
156 GlobalID = 10000;
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
157 }
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
158 return GlobalID;
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
159 }
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
160
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
161 /* This function adds a signal handler callback into the linked list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
162 */
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
163 void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
164 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
165 SignalHandler *new = malloc(sizeof(SignalHandler));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
166
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
167 new->message = message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
168 new->window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
169 new->id = id;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
170 new->signalfunction = signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
171 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
172 new->next = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
173
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
174 if (!Root)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
175 Root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
176 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
177 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
178 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
179 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
180 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
181 if(tmp->message == message &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
182 tmp->window == window &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
183 tmp->id == id &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
184 tmp->signalfunction == signalfunction)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
185 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
186 tmp->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
187 free(new);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
188 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
189 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
190 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
191 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
192 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
193 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
194 prev->next = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
195 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
196 Root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
197 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
198 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
199
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
200 /* Finds the message number for a given signal name */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
201 ULONG _findsigmessage(char *signame)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
202 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
203 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
204
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
205 for(z=0;z<SIGNALMAX;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
206 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
207 if(stricmp(signame, SignalTranslate[z].name) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
208 return SignalTranslate[z].message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
209 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
210 return 0L;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
211 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
212
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
213 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
214 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
215 MINIRECORDCORE rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
216 HPOINTER hptrIcon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
217 PVOID user;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
218 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
219
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
220 } 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
221
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
222
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
223 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
224 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
225 window = window; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
226 key = key; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
227 data = data; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
228 return TRUE;
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
229 }
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
230
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
231 /* 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
232 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
233 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
234 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
235
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
236 /* Find the toplevel window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
237 while((box = WinQueryWindow(lastbox, QW_PARENT)) != desktop && box > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
238 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
239 lastbox = box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
240 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
241 if(box > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
242 return lastbox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
243 return handle;
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
244 }
ab9b0fa6c66e Focus fixes and removal of several hack in the OS/2 code base.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 63
diff changeset
245
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
246
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
247 /* 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
248 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
249 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
250 unsigned long height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
251 dw_window_get_pos_size(handle, NULL, NULL, NULL, &height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
252 return (int)height;
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
253 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
254
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
255 /* 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
256 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
257 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
258 while(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
259 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
260 HWND client;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
261 if((client = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
262 {
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
263 return _get_height(WinQueryWindow(handle, QW_PARENT));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
264 }
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
265 handle = WinQueryWindow(handle, QW_PARENT);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
266 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
267 return dw_screen_height();
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
268 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
269
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
270 /* 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
271 * 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
272 */
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
273 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
274 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
275 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
276 int z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
277
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
278 while((int)(res = WinSendMsg(hwnd, msg, mp1, mp2)) == failure)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
279 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
280 z++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
281 if(z > 5000000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
282 return (MRESULT)failure;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
283 dw_main_sleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
284 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
285 return res;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
286 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
287
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
288 /* 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
289 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
290 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
291 return SHORT2FROMMP(WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0));
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
292 }
c0a708e2cba3 Removed dw_percent_get_range() to simplify coding. The range is now always
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 559
diff changeset
293
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
294 /* Return the entryfield child of a window */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
295 HWND _find_entryfield(HWND handle)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
296 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
297 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
298 HWND child, entry = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
299
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
300 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
301 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
302 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
303 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
304
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
305 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
306
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
307 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
308 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
309 entry = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
310 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
311 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
312 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
313 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
314 return entry;
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
315 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
316
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
317 /* 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
318 * 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
319 */
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
320 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
321 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
322 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
323 HWND child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
324
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
325 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
326 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
327 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
328 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
329
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
330 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
331
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
332 if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
333 WinSetOwner(child, dw);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
334 else if(strncmp(tmpbuf, "dynamicwindows", 14) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
335 dw = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
336
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
337 _fix_button_owner(child, dw);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
338 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
339 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
340 return;
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
341 }
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
342
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
343 /* 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
344 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
345 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
346 HBITMAP hbm = (HBITMAP)dw_window_get_data(handle, "_dw_bitmap");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
347 HPS hps = (HPS)dw_window_get_data(handle, "_dw_hps");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
348 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
349 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
350 HPIXMAP disable = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
351 HPOINTER icon = (HPOINTER)dw_window_get_data(handle, "_dw_button_icon");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
352
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
353 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
354 WinDestroyPointer(icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
355
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
356 if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
357 dw_pixmap_destroy(pixmap);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
358
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
359 if(disable)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
360 dw_pixmap_destroy(disable);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
361
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
362 if(hps)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
363 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
364 GpiSetBitmap(hps, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
365 GpiAssociate(hps, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
366 GpiDestroyPS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
367 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
368
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
369 if(hdc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
370 DevCloseDC(hdc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
371
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
372 if(hbm)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
373 GpiDeleteBitmap(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
374 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
375
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
376 /* This function removes any handlers on windows and frees
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
377 * the user memory allocated to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
378 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
379 void _free_window_memory(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
380 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
381 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
382 HWND child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
383 void *ptr = (void *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
384
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
385 dw_signal_disconnect_by_window(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
386
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
387 if((child = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
388 _free_menu_data(child);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
389
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
390 if((child = WinWindowFromID(handle, FID_CLIENT)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
391 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
392 Box *box = (Box *)WinQueryWindowPtr(child, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
393
963
ea356c38f7b6 Fixed a coordinate system issue with the button press handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 962
diff changeset
394 if(box && !dw_window_get_data(handle, "_dw_box"))
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
395 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
396 if(box->count && box->items)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
397 free(box->items);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
398
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
399 WinSetWindowPtr(child, QWP_USER, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
400 free(box);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
401 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
402 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
403
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
404 if(ptr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
405 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
406 WindowData *wd = (WindowData *)ptr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
407 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
408
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
409 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
410
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
411 if(strncmp(tmpbuf, "ColorSelectClass", 17)!=0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
412 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
413 /* If this window has an associate bitmap destroy it. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
414 _free_bitmap(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
415
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
416 if(strncmp(tmpbuf, "#1", 3)==0 && !WinWindowFromID(handle, FID_CLIENT))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
417 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
418 Box *box = (Box *)ptr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
419
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
420 if(box->count && box->items)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
421 free(box->items);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
422 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
423 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
424 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
425 void *data = dw_window_get_data(handle, "_dw_percent");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
426
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
427 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
428 free(data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
429 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
430 else if(strncmp(tmpbuf, "#37", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
431 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
432 dw_container_clear(handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
433 if(wd && dw_window_get_data(handle, "_dw_container"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
434 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
435 void *oldflags = wd->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
436
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
437 wd->data = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
438 free(oldflags);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
439 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
440 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
441
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
442 if(wd->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
443 WinSubclassWindow(handle, wd->oldproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
444
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
445 dw_window_set_data(handle, NULL, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
446 WinSetWindowPtr(handle, QWP_USER, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
447 free(ptr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
448 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
449 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
450
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
451 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
452 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
453 _free_window_memory(child);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
454
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
455 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
456 return;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
457 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
458
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
459 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
460 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
461 int i, count = (int)WinSendMsg(menu, MM_QUERYITEMCOUNT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
462
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
463 dw_signal_disconnect_by_name(menu, DW_SIGNAL_CLICKED);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
464 _free_window_memory(menu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
465
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
466 for(i=0;i<count;i++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
467 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
468 SHORT menuid = (SHORT)(LONG)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
469 MENUITEM mi;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
470
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
471 /* Free the data associated with the ID */
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
472 if(menuid >= 30000)
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
473 {
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
474 char buffer[31] = {0};
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
475
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
476 sprintf(buffer, "_dw_id%d", menuid);
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
477 dw_window_set_data( hwndApp, buffer, NULL );
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
478 sprintf(buffer, "_dw_checkable%d", menuid);
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
479 dw_window_set_data( hwndApp, buffer, NULL );
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
480 sprintf(buffer, "_dw_ischecked%d", menuid);
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
481 dw_window_set_data( hwndApp, buffer, NULL );
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
482 sprintf(buffer, "_dw_isdisabled%d", menuid);
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
483 dw_window_set_data( hwndApp, buffer, NULL );
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
484 }
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
485
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
486 /* Check any submenus */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
487 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
488 && mi.hwndSubMenu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
489 _free_menu_data(mi.hwndSubMenu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
490 }
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
491 }
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
492
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
493 /* This function returns 1 if the window (widget) handle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
494 * passed to it is a valid window that can gain input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
495 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
496 int _validate_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
497 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
498 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
499
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
500 if(!handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
501 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
502
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
503 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
504
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
505 if(!WinIsWindowEnabled(handle) ||
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
506 (strncmp(tmpbuf, "ColorSelectClass", 17) && dw_window_get_data(handle, "_dw_disabled")))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
507 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
508
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
509 /* These are the window classes which can
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
510 * obtain input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
511 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
512 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
513 strncmp(tmpbuf, "#3", 3)==0 || /* Button */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
514 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
515 strncmp(tmpbuf, "#7", 3)==0 || /* List box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
516 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
517 strncmp(tmpbuf, "#32", 4)==0 || /* Spinbutton */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
518 strncmp(tmpbuf, "#37", 4)==0 || /* Container */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
519 strncmp(tmpbuf, "#38", 4)== 0) /* Slider */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
520 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
521 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
522 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
523
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
524 int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
525 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
526 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
527 static HWND lasthwnd, firsthwnd;
1337
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
528 static int finish_searching;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
529
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
530 /* Start is 2 when we have cycled completely and
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
531 * need to set the focus to the last widget we found
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
532 * that was valid.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
533 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
534 if(start == 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
535 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
536 if(lasthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
537 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
538 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
539 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
540
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
541 /* Start is 1 when we are entering the function
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
542 * for the first time, it is zero when entering
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
543 * the function recursively.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
544 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
545 if(start == 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
546 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
547 lasthwnd = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
548 finish_searching = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
549 firsthwnd = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
550 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
551
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
552 for(z=box->count-1;z>-1;z--)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
553 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
554 if(box->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
555 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
556 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
557
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
558 if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
559 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
560 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
561 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
562 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
563 if(box->items[z].hwnd == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
564 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
565 if(lasthwnd == handle && firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
566 WinSetFocus(HWND_DESKTOP, firsthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
567 else if(lasthwnd == handle && !firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
568 finish_searching = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
569 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
570 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
571
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
572 /* If we aren't looking for the last handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
573 * return immediately.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
574 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
575 if(!finish_searching)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
576 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
577 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
578 if(_validate_focus(box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
579 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
580 /* Start is 3 when we are looking for the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
581 * first valid item in the layout.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
582 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
583 if(start == 3)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
584 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
585 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
586 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
587 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
588 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
589 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
590 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
591
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
592 if(!firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
593 firsthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
594
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
595 lasthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
596 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
597 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
598 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
599 char tmpbuf[100] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
600
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
601 WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
602 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
603 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
604 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
605 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
606
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
607 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
608 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
609 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
610
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
611 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
612 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
613 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
614
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
615 /* Try the top or left box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
616 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
617
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
618 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
619 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
620 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
621
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
622 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
623 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
624 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
625 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
626 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
627 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
628 Box *notebox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
629 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
630 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
631
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
632 if(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
633 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
634 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
635
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
636 if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
637 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
638 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
639 }
904
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
640 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) /* Scrollbox */
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
641 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
642 /* Get the box window handle */
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
643 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_box");
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
644
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
645 if(mybox)
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
646 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
647 Box *scrollbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
648
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
649 if(scrollbox && _focus_check_box(scrollbox, handle, start == 3 ? 3 : 0, defaultitem))
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
650 return 1;
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
651 }
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
652 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
653 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
654 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
655 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
656 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
657 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
658
61
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
659 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
660 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
661 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
662 static HWND lasthwnd, firsthwnd;
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
663 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
664
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
665 /* Start is 2 when we have cycled completely and
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
666 * need to set the focus to the last widget we found
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
667 * that was valid.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
668 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
669 if(start == 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
670 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
671 if(lasthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
672 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
673 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
674 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
675
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
676 /* Start is 1 when we are entering the function
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
677 * for the first time, it is zero when entering
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
678 * the function recursively.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
679 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
680 if(start == 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
681 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
682 lasthwnd = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
683 finish_searching = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
684 firsthwnd = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
685 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
686
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
687 for(z=0;z<box->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
688 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
689 if(box->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
690 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
691 Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
692
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
693 if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
694 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
695 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
696 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
697 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
698 if(box->items[z].hwnd == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
699 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
700 if(lasthwnd == handle && firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
701 WinSetFocus(HWND_DESKTOP, firsthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
702 else if(lasthwnd == handle && !firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
703 finish_searching = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
704 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
705 WinSetFocus(HWND_DESKTOP, lasthwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
706
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
707 /* If we aren't looking for the last handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
708 * return immediately.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
709 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
710 if(!finish_searching)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
711 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
712 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
713 if(_validate_focus(box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
714 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
715 /* Start is 3 when we are looking for the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
716 * first valid item in the layout.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
717 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
718 if(start == 3)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
719 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
720 if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
721 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
722 WinSetFocus(HWND_DESKTOP, box->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
723 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
724 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
725 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
726
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
727 if(!firsthwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
728 firsthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
729
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
730 lasthwnd = box->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
731 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
732 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
733 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
734 char tmpbuf[100] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
735
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
736 WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
737 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
738 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
739 /* Try the top or left box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
740 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
741
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
742 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
743 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
744 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
745
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
746 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
747 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
748 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
749
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
750 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
751 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
752
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
753 if(mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
754 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
755 Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
756
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
757 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
758 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
759 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
760 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
761 else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
762 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
763 Box *notebox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
764 HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
765 (MPARAM)dw_notebook_page_get(box->items[z].hwnd), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
766
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
767 if(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
768 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
769 notebox = (Box *)WinQueryWindowPtr(page, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
770
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
771 if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
772 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
773 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
774 }
904
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
775 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) /* Scrollbox */
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
776 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
777 /* Get the box window handle */
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
778 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_box");
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
779
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
780 if(mybox)
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
781 {
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
782 Box *scrollbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER);
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
783
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
784 if(scrollbox && _focus_check_box_back(scrollbox, handle, start == 3 ? 3 : 0, defaultitem))
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
785 return 1;
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
786 }
6ed34b83a741 Fixed scrollbox tab and shift tab focus shifting on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 849
diff changeset
787 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
788 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
789 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
790 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
791 return 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
792 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
793
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
794 /* This function finds the first widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
795 * layout and moves the current focus to it.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
796 */
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
797 int _initial_focus(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
798 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
799 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
800 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
801
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
802 box = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
803 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
804 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
805 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
806 return 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
807
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
808 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
809 _focus_check_box(thisbox, handle, 3, thisbox->defaultitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
810 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
811 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
812
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
813 /* This function finds the current widget in the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
814 * layout and moves the current focus to the next item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
815 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
816 void _shift_focus(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
817 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
818 Box *thisbox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
819 HWND box, lastbox = _toplevel_window(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
820
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
821 box = WinWindowFromID(lastbox, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
822 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
823 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
824 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
825 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
826
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
827 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
828 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
829 if(_focus_check_box(thisbox, handle, 1, 0) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
830 _focus_check_box(thisbox, handle, 2, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
831 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
832 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
833
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
834 /* 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
835 * 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
836 */
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
837 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
838 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
839 Box *thisbox;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
840 HWND box, lastbox = _toplevel_window(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
841
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
842 box = WinWindowFromID(lastbox, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
843 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
844 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
845 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
846 thisbox = WinQueryWindowPtr(lastbox, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
847
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
848 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
849 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
850 if(_focus_check_box_back(thisbox, handle, 1, 0) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
851 _focus_check_box_back(thisbox, handle, 2, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
852 }
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
853 }
4a02842f8074 Added shift-tab and up/down/left/right button support. And added missing
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 60
diff changeset
854
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
855 /* This function will recursively search a box and add up the total height of it */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
856 void _count_size(HWND box, int type, int *xsize, int *xorigsize)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
857 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
858 int size = 0, origsize = 0, z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
859 Box *tmp = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
860
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
861 if(!tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
862 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
863 *xsize = *xorigsize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
864 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
865 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
866
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
867 if(type == tmp->type)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
868 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
869 /* If the box is going in the direction we want, then we
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
870 * return the entire sum of the items.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
871 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
872 for(z=0;z<tmp->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
873 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
874 if(tmp->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
875 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
876 int s, os;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
877
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
878 _count_size(tmp->items[z].hwnd, type, &s, &os);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
879 size += s;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
880 origsize += os;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
881 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
882 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
883 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
884 size += (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
885 origsize += (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
886 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
887 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
888 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
889 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
890 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
891 /* If the box is not going in the direction we want, then we only
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
892 * want to return the maximum value.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
893 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
894 int tmpsize = 0, tmporigsize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
895
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
896 for(z=0;z<tmp->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
897 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
898 if(tmp->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
899 _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
900 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
901 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
902 tmpsize = (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
903 tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
904 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
905
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
906 if(tmpsize > size)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
907 size = tmpsize;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
908 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
909 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
910
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
911 *xsize = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
912 *xorigsize = origsize;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
913 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
914
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
915
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
916 /* Function: TrackRectangle
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
917 * Abstract: Tracks given rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
918 *
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
919 * If rclBounds is NULL, then track rectangle on entire desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
920 * rclTrack is in window coorditates and will be mapped to
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
921 * desktop.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
922 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
923
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
924 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
925 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
926 TRACKINFO track;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
927 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
928
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
929 track.cxBorder = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
930 track.cyBorder = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
931 track.cxGrid = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
932 track.cyGrid = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
933 track.cxKeyboard = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
934 track.cyKeyboard = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
935
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
936 if(!rclTrack)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
937 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
938
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
939 if(rclBounds)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
940 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
941 track.rclBoundary = *rclBounds;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
942 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
943 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
944 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
945 track.rclBoundary.yTop =
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
946 track.rclBoundary.xRight = 3000;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
947 track.rclBoundary.yBottom =
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
948 track.rclBoundary.xLeft = -3000;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
949 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
950
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
951 track.rclTrack = *rclTrack;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
952
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
953 WinMapWindowPoints(hwndBase,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
954 HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
955 (PPOINTL)&track.rclTrack,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
956 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
957
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
958 track.ptlMinTrackSize.x = track.rclTrack.xRight
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
959 - track.rclTrack.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
960 track.ptlMinTrackSize.y = track.rclTrack.yTop
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
961 - track.rclTrack.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
962 track.ptlMaxTrackSize.x = track.rclTrack.xRight
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
963 - track.rclTrack.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
964 track.ptlMaxTrackSize.y = track.rclTrack.yTop
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
965 - track.rclTrack.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
966
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
967 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
968
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
969 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
970
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
971 if(rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
972 *rclTrack = track.rclTrack;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
973
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
974 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
975 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
976
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
977 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
978 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
979 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
980
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
981 WinQueryClassName(hwnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
982
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
983 /* If we have a notebook we resize the page again. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
984 if(strncmp(tmpbuf, "#40", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
985 {
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
986 long x, y;
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
987 unsigned long width, height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
988 ULONG page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, 0, MPFROM2SHORT(BKA_FIRST, BKA_MAJOR));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
989
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
990 while(page)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
991 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
992 HWND pagehwnd = (HWND)WinSendMsg(hwnd, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(page), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
993 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
994
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
995 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
996 if(pagebox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
997 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
998 dw_window_get_pos_size(hwnd, &x, &y, &width, &height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
999
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1000 rc.xLeft = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1001 rc.yBottom = y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1002 rc.xRight = x + width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1003 rc.yTop = y + height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1004
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1005 WinSendMsg(hwnd, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1006
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1007 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1008 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1009 page = (ULONG)WinSendMsg(hwnd, BKM_QUERYPAGEID, (MPARAM)page, MPFROM2SHORT(BKA_NEXT, BKA_MAJOR));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1010 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1011
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1012 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1013 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
1014
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
1015 /* 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
1016 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
1017 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1018 if(color < 16)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1019 return _colors[color];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1020 return 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
1021 }
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
1022
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
1023 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
1024 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1025 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
1026 }
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
1027
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1028 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
1029 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1030 int height = _get_height(parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1031
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1032 return WinSetWindowPos(hwnd, behind, x, height - y - cy, cx, cy, fl);
535
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1033 }
b0b5b880513a Don't reverse packing on vertical boxes to compensate for the inverted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 531
diff changeset
1034
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1035 #define _DW_DEFAULT_SCROLLBAR_WIDTH 16
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1036
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1037 /* This function calculates how much space the widgets and boxes require
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1038 * and does expansion as necessary.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1039 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1040 int _resize_box(Box *thisbox, int *depth, int x, int y, int *usedx, int *usedy,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1041 int pass, int *usedpadx, int *usedpady)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1042 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1043 int z, currentx = 0, currenty = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1044 int uymax = 0, uxmax = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1045 int upymax = 0, upxmax = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1046 /* Used for the SIZEEXPAND */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1047 int nux = *usedx, nuy = *usedy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1048 int nupx = *usedpadx, nupy = *usedpady;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1049
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1050 (*usedx) += (thisbox->pad * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1051 (*usedy) += (thisbox->pad * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1052
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1053 if(thisbox->grouphwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1054 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1055 char *text = dw_window_get_text(thisbox->grouphwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1056
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1057 thisbox->grouppady = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1058
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1059 if(text)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1060 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1061 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1062 dw_free(text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1063 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1064
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1065 if(thisbox->grouppady)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1066 thisbox->grouppady += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1067 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1068 thisbox->grouppady = 6;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1069
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1070 thisbox->grouppadx = 6;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1071
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1072 (*usedx) += thisbox->grouppadx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1073 (*usedpadx) += thisbox->grouppadx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1074 (*usedy) += thisbox->grouppady;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1075 (*usedpady) += thisbox->grouppady;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1076 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1077
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1078 for(z=0;z<thisbox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1079 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1080 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1081 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1082 int initialx, initialy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1083 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1084
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1085 initialx = x - (*usedx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1086 initialy = y - (*usedy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1087
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1088 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1089 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1090 int newx, newy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1091 int nux = *usedx, nuy = *usedy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1092 int upx = *usedpadx + (tmp->pad*2), upy = *usedpady + (tmp->pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1093
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1094 /* On the second pass we know how big the box needs to be and how
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1095 * much space we have, so we can calculate a ratio for the new box.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1096 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1097 if(pass == 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1098 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1099 int deep = *depth + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1100
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1101 _resize_box(tmp, &deep, x, y, &nux, &nuy, 1, &upx, &upy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1102
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1103 tmp->upx = upx - *usedpadx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1104 tmp->upy = upy - *usedpady;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1105
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1106 newx = x - nux;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1107 newy = y - nuy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1108
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1109 tmp->width = thisbox->items[z].width = initialx - newx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1110 tmp->height = thisbox->items[z].height = initialy - newy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1111
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1112 tmp->parentxratio = thisbox->xratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1113 tmp->parentyratio = thisbox->yratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1114
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1115 tmp->parentpad = tmp->pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1116
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1117 /* Just in case */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1118 tmp->xratio = thisbox->xratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1119 tmp->yratio = thisbox->yratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1120
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1121 if(thisbox->type == DW_VERT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1122 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1123 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppady;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1124
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1125 if((thisbox->items[z].width - tmppad)!=0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1126 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmppad))/((float)(thisbox->items[z].width-tmppad));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1127 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1128 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1129 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1130 if((thisbox->items[z].width-tmp->upx)!=0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1131 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1132 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1133 if(thisbox->type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1134 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1135 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppadx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1136
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1137 if((thisbox->items[z].height-tmppad)!=0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1138 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmppad))/((float)(thisbox->items[z].height-tmppad));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1139 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1140 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1141 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1142 if((thisbox->items[z].height-tmp->upy)!=0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1143 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1144 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1145
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1146 nux = *usedx; nuy = *usedy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1147 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1148 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1149
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1150 (*depth)++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1151
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1152 _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1153
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1154 (*depth)--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1155
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1156 newx = x - nux;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1157 newy = y - nuy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1158
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1159 tmp->minwidth = thisbox->items[z].width = initialx - newx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1160 tmp->minheight = thisbox->items[z].height = initialy - newy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1161 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1162 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1163
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1164 if(pass > 1 && *depth > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1165 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1166 if(thisbox->type == DW_VERT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1167 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1168 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppadx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1169
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1170 if((thisbox->minwidth-tmppad) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1171 thisbox->items[z].xratio = 1.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1172 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1173 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-tmppad))/((float)(thisbox->minwidth-tmppad));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1174 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1175 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1176 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1177 if(thisbox->minwidth-thisbox->upx == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1178 thisbox->items[z].xratio = 1.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1179 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1180 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1181 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1182
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1183 if(thisbox->type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1184 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1185 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppady;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1186
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1187 if((thisbox->minheight-tmppad) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1188 thisbox->items[z].yratio = 1.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1189 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1190 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-tmppad))/((float)(thisbox->minheight-tmppad));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1191 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1192 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1193 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1194 if(thisbox->minheight-thisbox->upy == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1195 thisbox->items[z].yratio = 1.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1196 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1197 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1198 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1199
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1200 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1201 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1202 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1203
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1204 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1205 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1206 tmp->parentxratio = thisbox->items[z].xratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1207 tmp->parentyratio = thisbox->items[z].yratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1208 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1209 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1210 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1211 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1212 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1213 thisbox->items[z].xratio = thisbox->xratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1214 thisbox->items[z].yratio = thisbox->yratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1215 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1216
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1217 if(thisbox->type == DW_VERT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1218 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1219 int itemwidth = thisbox->items[z].width + (thisbox->items[z].pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1220
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1221 if(itemwidth > uxmax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1222 uxmax = itemwidth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1223 if(thisbox->items[z].hsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1224 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1225 if(itemwidth > upxmax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1226 upxmax = itemwidth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1227 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1228 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1229 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1230 if(thisbox->items[z].pad*2 > upxmax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1231 upxmax = thisbox->items[z].pad*2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1232 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1233 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1234 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1235 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1236 if(thisbox->items[z].width == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1237 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1238 /* figure out how much space this item requires */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1239 /* thisbox->items[z].width = */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1240 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1241 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1242 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1243 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1244 if(thisbox->items[z].hsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1245 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1246 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1247 (*usedpadx) += thisbox->items[z].pad*2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1248 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1249 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1250 if(thisbox->type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1251 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1252 int itemheight = thisbox->items[z].height + (thisbox->items[z].pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1253
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1254 if(itemheight > uymax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1255 uymax = itemheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1256 if(thisbox->items[z].vsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1257 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1258 if(itemheight > upymax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1259 upymax = itemheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1260 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1261 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1262 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1263 if(thisbox->items[z].pad*2 > upymax)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1264 upymax = thisbox->items[z].pad*2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1265 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1266 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1267 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1268 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1269 if(thisbox->items[z].height == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1270 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1271 /* figure out how much space this item requires */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1272 /* thisbox->items[z].height = */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1273 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1274 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1275 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1276 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1277 if(thisbox->items[z].vsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1278 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1279 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1280 (*usedpady) += thisbox->items[z].pad*2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1281 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1282 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1283 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1284
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1285 (*usedx) += uxmax;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1286 (*usedy) += uymax;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1287 (*usedpadx) += upxmax;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1288 (*usedpady) += upymax;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1289
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1290 currentx += thisbox->pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1291 currenty += thisbox->pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1292
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1293 if(thisbox->grouphwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1294 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1295 currentx += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1296 currenty += thisbox->grouppady - 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1297 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1298
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1299 /* The second pass is for expansion and actual placement. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1300 if(pass > 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1301 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1302 /* Any SIZEEXPAND items should be set to uxmax/uymax */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1303 for(z=0;z<thisbox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1304 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1305 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1306 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1307 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1308 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1309 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1310 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1311 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1312 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1313
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1314 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1315 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1316 if(*depth > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1317 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1318 float calcval;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1319
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1320 if(thisbox->type == DW_VERT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1321 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1322 calcval = (float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1323 if(calcval == 0.0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1324 tmp->xratio = thisbox->xratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1325 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1326 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1327 tmp->width = thisbox->items[z].width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1328 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1329 if(thisbox->type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1330 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1331 calcval = (float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1332 if(calcval == 0.0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1333 tmp->yratio = thisbox->yratio;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1334 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1335 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/calcval;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1336 tmp->height = thisbox->items[z].height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1337 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1338 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1339
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1340 (*depth)++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1341
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1342 _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1343
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1344 (*depth)--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1345
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1346 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1347 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1348 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1349
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1350 for(z=0;z<(thisbox->count);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1351 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1352 int height = thisbox->items[z].height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1353 int width = thisbox->items[z].width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1354 int pad = thisbox->items[z].pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1355 HWND handle = thisbox->items[z].hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1356 int vectorx, vectory;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1357
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1358 /* When upxmax != pad*2 then ratios are incorrect. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1359 vectorx = (int)((width*thisbox->items[z].xratio)-width);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1360 vectory = (int)((height*thisbox->items[z].yratio)-height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1361
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1362 if(width > 0 && height > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1363 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1364 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1365 /* This is a hack to fix rounding of the sizing */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1366 if(*depth == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1367 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1368 vectorx++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1369 vectory++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1370 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1371
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1372 /* If this item isn't going to expand... reset the vectors to 0 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1373 if(thisbox->items[z].vsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1374 vectory = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1375 if(thisbox->items[z].hsize != SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1376 vectorx = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1377
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
1378 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1379
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1380 if(strncmp(tmpbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1381 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1382 HWND frame = (HWND)dw_window_get_data(handle, "_dw_combo_box");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1383 /* Make the combobox big enough to drop down. :) */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1384 WinSetWindowPos(handle, HWND_TOP, 0, -100,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1385 width + vectorx, (height + vectory) + 100, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1386 _MySetWindowPos(frame, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1387 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1388 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1389 else if(strncmp(tmpbuf, "#6", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1390 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1391 /* Entryfields on OS/2 have a thick border that isn't on Windows and GTK */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1392 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, (currentx + pad) + 3, (currenty + pad) + 3,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1393 (width + vectorx) - 6, (height + vectory) - 6, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1394 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1395 else if(strncmp(tmpbuf, "#40", 5)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1396 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1397 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1398 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1399 _check_resize_notebook(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1400 }
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1401 else if(strncmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0)
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1402 {
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1403 /* Handle special case of scrollbox */
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1404 int cx = width + vectorx;
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1405 int cy = height + vectory;
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1406 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0;
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1407 HWND box = (HWND)dw_window_get_data(handle, "_dw_resizebox");
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1408 HWND client = WinWindowFromID(handle, FID_CLIENT);
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1409 HWND vscroll = WinWindowFromID(handle, FID_VERTSCROLL);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1410 HWND hscroll = WinWindowFromID(handle, FID_HORZSCROLL);
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1411 Box *contentbox = (Box *)WinQueryWindowPtr(box, QWP_USER);
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1412 int origx, origy;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1413 unsigned int hpos = (unsigned int)WinSendMsg(hscroll, SBM_QUERYPOS, 0, 0);
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1414 unsigned int vpos = (unsigned int)WinSendMsg(vscroll, SBM_QUERYPOS, 0, 0);
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1415
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1416 /* Position the scrollbox parts */
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1417 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad, cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1418 WinSetWindowPos(client, HWND_TOP, 0, _DW_DEFAULT_SCROLLBAR_WIDTH, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, cy - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1419 WinSetWindowPos(hscroll, HWND_TOP, 0, 0, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1420 WinSetWindowPos(vscroll, HWND_TOP, cx - _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, _DW_DEFAULT_SCROLLBAR_WIDTH, cy - _DW_DEFAULT_SCROLLBAR_WIDTH, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1421
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1422 origx = cx = cx - _DW_DEFAULT_SCROLLBAR_WIDTH;
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1423 origy = cy = cy - _DW_DEFAULT_SCROLLBAR_WIDTH;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1424
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1425 /* Get the required space for the box */
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1426 _resize_box(contentbox, &depth, cx, cy, &usedx, &usedy, 1, &usedpadx, &usedpady);
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1427
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1428 if(cx < usedx)
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1429 {
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1430 cx = usedx;
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1431 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1432 if(cy < usedy)
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1433 {
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1434 cy = usedy;
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1435 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1436
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1437 /* Setup vertical scroller */
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1438 WinSendMsg(vscroll, SBM_SETSCROLLBAR, (MPARAM)vpos, MPFROM2SHORT(0, (unsigned short)usedy - origy));
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1439 WinSendMsg(vscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origy, usedy), 0);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1440 if(vpos > usedy)
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1441 {
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1442 vpos = usedy;
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1443 WinSendMsg(vscroll, SBM_SETPOS, (MPARAM)vpos, 0);
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1444 }
964
6c6b5bbd3a26 Some code cleanups for OS/2 while attempting to track down an issue in _free_window_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 963
diff changeset
1445
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1446 /* Setup horizontal scroller */
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1447 WinSendMsg(hscroll, SBM_SETSCROLLBAR, (MPARAM)hpos, MPFROM2SHORT(0, (unsigned short)usedx - origx));
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1448 WinSendMsg(hscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)origx, usedx), 0);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1449 if(hpos > usedx)
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1450 {
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1451 hpos = usedx;
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1452 WinSendMsg(hscroll, SBM_SETPOS, (MPARAM)hpos, 0);
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1453 }
964
6c6b5bbd3a26 Some code cleanups for OS/2 while attempting to track down an issue in _free_window_data().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 963
diff changeset
1454
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1455 /* Position the scrolled box */
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1456 WinSetWindowPos(box, HWND_TOP, 0, -(cy - origy), cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1457
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1458 dw_window_set_data(handle, "_dw_cy", (void *)(cy - origy));
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1459
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1460 /* Layout the content of the scrollbox */
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
1461 _do_resize(contentbox, cx, cy);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1462 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1463 else if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1464 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1465 /* Then try the bottom or right box */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1466 float *percent = (float *)dw_window_get_data(handle, "_dw_percent");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1467 int type = (int)dw_window_get_data(handle, "_dw_type");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1468 int cx = width + vectorx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1469 int cy = height + vectory;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1470
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1471 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1472 cx, cy, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1473
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1474 if(cx > 0 && cy > 0 && percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1475 _handle_splitbar_resize(handle, *percent, type, cx, cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1476 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1477 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1478 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1479 _MySetWindowPos(handle, thisbox->hwnd, HWND_TOP, currentx + pad, currenty + pad,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1480 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE | SWP_ZORDER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1481 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1482 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1483 Box *boxinfo = WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1484
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1485 if(boxinfo && boxinfo->grouphwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1486 WinSetWindowPos(boxinfo->grouphwnd, HWND_TOP, 0, 0,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1487 width + vectorx, height + vectory, SWP_MOVE | SWP_SIZE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1488
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1489 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1490
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1491 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1492
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1493 if(thisbox->type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1494 currentx += width + vectorx + (pad * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1495 if(thisbox->type == DW_VERT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1496 currenty += height + vectory + (pad * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1497 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1498 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1499 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1500 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1501 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1502
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1503 void _do_resize(Box *thisbox, int x, int y)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1504 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1505 if(x != 0 && y != 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1506 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1507 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1508 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1509 int usedx = 0, usedy = 0, usedpadx = 0, usedpady = 0, depth = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1510
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1511 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 1, &usedpadx, &usedpady);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1512
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1513 if(usedx-usedpadx == 0 || usedy-usedpady == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1514 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1515
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1516 thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1517 thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1518
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1519 usedx = usedy = usedpadx = usedpady = depth = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1520
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1521 _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1522 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1523 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1524 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1525
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1526 /* This procedure handles WM_QUERYTRACKINFO requests from the frame */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1527 MRESULT EXPENTRY _sizeproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1528 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1529 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1530 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1531 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1532
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1533 box = WinWindowFromID(hWnd, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1534 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1535 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1536
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1537 if(thisbox && !thisbox->titlebar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1538 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1539 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1540 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1541 case WM_QUERYTRACKINFO:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1542 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1543 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1544 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1545 PTRACKINFO ptInfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1546 int res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1547 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1548 res = (int)myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1549
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1550 ptInfo = (PTRACKINFO)(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1551
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1552 ptInfo->ptlMinTrackSize.y = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1553 ptInfo->ptlMinTrackSize.x = 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1554
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1555 return (MRESULT)res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1556 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1557 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1558 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1559 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1560
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1561 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1562 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1563 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1564 return myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1565 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1566
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1567 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
1568 }
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1569
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1570 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
1571 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1572 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1573
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1574 ptl1.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1575 ptl2.y = ptl1.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1576 ptl2.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1577 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1578 GpiLine(hpsPaint, &ptl2);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1579 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1580
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1581 /* 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
1582 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
1583 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1584 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1585
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1586 ptl2.x = ptl1.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1587 ptl1.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1588 ptl2.y = rclPaint.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1589 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1590 GpiLine(hpsPaint, &ptl2);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1591 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1592
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1593 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
1594 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1595 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1596
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1597 ptl1.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1598 ptl1.y = ptl2.y = rclPaint.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1599 ptl2.x = rclPaint.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1600 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1601 GpiLine(hpsPaint, &ptl2);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1602 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1603
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1604 /* 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
1605 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
1606 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1607 POINTL ptl1, ptl2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1608
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1609 ptl2.x = ptl1.x = rclPaint.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1610 ptl1.y = rclPaint.yBottom + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1611 ptl2.y = rclPaint.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1612 GpiMove(hpsPaint, &ptl1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1613 GpiLine(hpsPaint, &ptl2);
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1614 }
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
1615
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1616
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1617 #define CALENDAR_BORDER 3
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1618 #define CALENDAR_ARROW 8
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1619
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1620 /* Returns a rectangle for a single day on the calendar */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1621 RECTL _CalendarDayRect(int position, RECTL rclPaint)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1622 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1623 int height = rclPaint.yTop - rclPaint.yBottom - (CALENDAR_BORDER*2);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1624 int width = rclPaint.xRight - rclPaint.xLeft - (CALENDAR_BORDER*2);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1625 /* There are 7 rows... 5 for the day numbers...
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1626 * 1 for the Month/Year and 1 for the day names.
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1627 */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1628 int row = position / 7;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1629 int col = position % 7;
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1630 int cellwidth = width / 7;
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1631 int cellheight = height / 8;
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1632
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1633 /* Create a new box */
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1634 rclPaint.xLeft = (cellwidth * col) + CALENDAR_BORDER;
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1635 rclPaint.xRight = rclPaint.xLeft + cellwidth;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1636 /* We only handle 6 of the 7 rows */
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1637 rclPaint.yBottom = (cellheight * (6-row)) + CALENDAR_BORDER;
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1638 rclPaint.yTop = rclPaint.yBottom + cellheight;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1639 return rclPaint;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1640 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1641
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1642 /* This procedure handles drawing of a status border */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1643 MRESULT EXPENTRY _calendarproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1644 {
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1645 /* How many days are in each month usually (not including leap years) */
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1646 static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1647 static char *months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1648 static char *daysofweek[] = { "Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday" };
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1649 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1650 PFNWP oldproc = 0;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1651
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1652 if(blah)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1653 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1654 oldproc = blah->oldproc;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1655
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1656 switch(msg)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1657 {
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1658 case WM_BUTTON1DOWN:
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1659 case WM_BUTTON2DOWN:
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1660 case WM_BUTTON3DOWN:
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1661 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1662 POINTS pts = (*((POINTS*)&mp1));
1349
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1663 int day = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_day"));
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1664 int month = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_month"));
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1665 int year = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_year"));
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1666 int dayofweek = 1, x, height, isleapyear = ((year+1) % 4 == 0);
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1667 int daysthismonth = days[month] + (isleapyear && month == 1);
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1668 RECTL rclArea;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1669
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1670 /* Figure out what day of the week the first day of the month falls on */
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1671 for(x=0;x<month;x++)
1349
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1672 dayofweek += days[x] + (isleapyear && x == 1);
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1673 dayofweek += (year/4) + year - 1;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1674 dayofweek = dayofweek % 7;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1675
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1676 WinQueryWindowRect(hWnd, &rclArea);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1677 height = ((rclArea.yTop - (CALENDAR_BORDER*2))/7);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1678
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1679 /* Check for the left arrow */
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1680 if(pts.x > rclArea.xLeft + CALENDAR_BORDER && pts.x < rclArea.xLeft + CALENDAR_BORDER + CALENDAR_ARROW &&
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1681 pts.y > rclArea.yTop - (CALENDAR_BORDER + height) && pts.y < rclArea.yTop - CALENDAR_BORDER)
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1682 {
1349
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1683 int daysthismonth;
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1684
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1685 if(month == 0)
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1686 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1687 month = 11;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1688 year--;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1689 dw_window_set_data(hWnd, "_dw_year", DW_INT_TO_POINTER(year));
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1690 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1691 else if(month > 0)
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1692 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1693 month--;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1694 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1695 dw_window_set_data(hWnd, "_dw_month", DW_INT_TO_POINTER(month));
1349
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1696 /* Make sure we aren't higher than the number of days
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1697 * in our new month... keeping track of leap years.
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1698 */
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1699 daysthismonth = days[month] + (isleapyear && month == 1);
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1700 if(day >= daysthismonth)
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1701 {
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1702 day = daysthismonth - 1;
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1703 dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER(day));
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1704 }
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1705 WinInvalidateRect(hWnd, &rclArea, FALSE);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1706 WinPostMsg(hWnd, WM_PAINT, 0, 0);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1707 return (MRESULT)TRUE;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1708 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1709
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1710 /* Check for the right arrow */
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1711 if(pts.x < rclArea.xRight - CALENDAR_BORDER && pts.x > rclArea.xRight - CALENDAR_BORDER - CALENDAR_ARROW &&
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1712 pts.y > rclArea.yTop - (CALENDAR_BORDER + height) && pts.y < rclArea.yTop - CALENDAR_BORDER)
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1713 {
1349
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1714 int daysthismonth;
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1715
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1716 if(month == 11)
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1717 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1718 month = 0;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1719 year++;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1720 dw_window_set_data(hWnd, "_dw_year", DW_INT_TO_POINTER(year));
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1721 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1722 else if(month < 11)
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1723 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1724 month++;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1725 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1726 dw_window_set_data(hWnd, "_dw_month", DW_INT_TO_POINTER(month));
1349
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1727 /* Make sure we aren't higher than the number of days
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1728 * in our new month... keeping track of leap years.
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1729 */
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1730 daysthismonth = days[month] + (isleapyear && month == 1);
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1731 if(day >= daysthismonth)
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1732 {
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1733 day = daysthismonth - 1;
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1734 dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER(day));
19aa1af6855e OS/2 calendar fix to make sure the selected day does not exceed the number
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1348
diff changeset
1735 }
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1736 WinInvalidateRect(hWnd, &rclArea, FALSE);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1737 WinPostMsg(hWnd, WM_PAINT, 0, 0);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1738 return (MRESULT)TRUE;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1739 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1740
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1741 /* Check all the valid days of the month */
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1742 for(x=dayofweek+7;x<(daysthismonth+dayofweek+7);x++)
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1743 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1744 RECTL rclThis = _CalendarDayRect(x, rclArea);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1745 if(pts.x < rclThis.xRight && pts.x > rclThis.xLeft && pts.y < rclThis.yTop && pts.y > rclThis.yBottom)
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1746 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1747 dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER((x-(dayofweek+7))));
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1748 WinInvalidateRect(hWnd, &rclArea, FALSE);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1749 WinPostMsg(hWnd, WM_PAINT, 0, 0);
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1750 return (MRESULT)TRUE;
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1751 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1752 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1753 }
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1754 break;
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1755 case WM_PAINT:
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1756 {
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1757 HPS hpsPaint;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1758 RECTL rclPaint, rclDraw;
1347
2bc23978cfcd Removed some unused variables in the new OS/2 code... as reported by gcc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1346
diff changeset
1759 char buf[100];
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1760 int day = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_day"));
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1761 int month = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_month"));
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1762 int year = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_year"));
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1763 int dayofweek = 1, x, lastmonth = 11, height, isleapyear = ((year+1) % 4 == 0);
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1764 POINTL pptl[3];
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1765
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1766 /* Figure out the previous month for later use */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1767 if(month > 0)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1768 lastmonth = month - 1;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1769
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1770 /* Make the title */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1771 sprintf(buf, "%s, %d", months[month], year + 1);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1772
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1773 /* Figure out what day of the week the first day of the month falls on */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1774 for(x=0;x<month;x++)
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1775 dayofweek += days[x] + (isleapyear && x == 1);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1776 dayofweek += (year/4) + year - 1;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1777 dayofweek = dayofweek % 7;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1778
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1779 /* Actually draw the control */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1780 hpsPaint = WinBeginPaint(hWnd, 0, 0);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1781 WinQueryWindowRect(hWnd, &rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1782 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1783 height = ((rclPaint.yTop - (CALENDAR_BORDER*2))/7);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1784
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1785 /* Draw the Month and Year at the top */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1786 GpiSetColor(hpsPaint, CLR_BLACK);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1787 rclDraw = rclPaint;
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1788 rclDraw.yBottom = height * 6;
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1789 WinDrawText(hpsPaint, -1, (PCH)buf, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1790
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1791 /* Draw the left arrow */
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1792 GpiSetColor(hpsPaint, CLR_DARKGRAY);
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1793 GpiBeginArea(hpsPaint, 0);
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1794 pptl[2].x = rclDraw.xLeft + CALENDAR_BORDER + CALENDAR_ARROW;
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1795 pptl[2].y = rclDraw.yTop - CALENDAR_BORDER;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1796 GpiMove(hpsPaint, &pptl[2]);
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1797 pptl[0].x = rclDraw.xLeft + CALENDAR_BORDER;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1798 pptl[0].y = rclDraw.yTop - (CALENDAR_BORDER+ (height/2));
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1799 pptl[1].x = rclDraw.xLeft + CALENDAR_BORDER + CALENDAR_ARROW;
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1800 pptl[1].y = rclDraw.yTop - CALENDAR_BORDER - height;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1801 GpiPolyLine(hpsPaint, 3, pptl);
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1802 GpiEndArea(hpsPaint);
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1803
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1804 /* Draw the left arrow */
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1805 GpiBeginArea(hpsPaint, 0);
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1806 pptl[2].x = rclDraw.xRight - CALENDAR_BORDER - CALENDAR_ARROW;
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1807 pptl[2].y = rclDraw.yTop - CALENDAR_BORDER;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1808 GpiMove(hpsPaint, &pptl[2]);
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1809 pptl[0].x = rclDraw.xRight - CALENDAR_BORDER;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1810 pptl[0].y = rclDraw.yTop - (CALENDAR_BORDER + (height/2));
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1811 pptl[1].x = rclDraw.xRight - CALENDAR_BORDER - CALENDAR_ARROW;
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1812 pptl[1].y = rclDraw.yTop - CALENDAR_BORDER - height;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1813 GpiPolyLine(hpsPaint, 3, pptl);
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1814 GpiEndArea(hpsPaint);
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1815
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1816 /* Draw a border around control */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1817 _Top(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1818 _Left(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1819 /* With shadow */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1820 GpiSetColor(hpsPaint, CLR_WHITE);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1821 _Right(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1822 _Bottom(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1823
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1824 /* Draw the days of the week */
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1825 GpiSetColor(hpsPaint, CLR_BLACK);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1826 for(x=0;x<7;x++)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1827 {
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1828 char *title = daysofweek[x];
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1829
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1830 rclDraw = _CalendarDayRect(x, rclPaint);
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1831
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1832 if(rclDraw.xRight - rclDraw.xLeft < 60)
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1833 {
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1834 buf[0] = daysofweek[x][0]; buf[1] = daysofweek[x][1]; buf[2] = 0;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1835 title = buf;
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1836 }
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1837 WinDrawText(hpsPaint, -1, (PCH)title, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1838 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1839
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1840 /* Go through all the days */
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1841 for(x=0;x<42;x++)
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1842 {
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1843 int daysthismonth = days[month] + (isleapyear && month == 1);
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1844 int dayslastmonth = days[lastmonth] + (isleapyear && lastmonth == 1);
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1845
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1846 rclDraw = _CalendarDayRect(x+7, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1847 if(x < dayofweek)
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1848 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1849 GpiSetColor(hpsPaint, CLR_DARKGRAY);
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1850 sprintf(buf, "%d", dayslastmonth - (dayofweek - x - 1));
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1851 }
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1852 else if(x - dayofweek + 1 > daysthismonth)
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1853 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1854 GpiSetColor(hpsPaint, CLR_DARKGRAY);
1348
64c8eba7c0fc Fixes for handling leap years on the OS/2 calendar control.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1347
diff changeset
1855 sprintf(buf, "%d", x - dayofweek - daysthismonth + 1);
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1856 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1857 else
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1858 {
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1859 GpiSetColor(hpsPaint, CLR_DARKBLUE);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1860 sprintf(buf, "%d", x - dayofweek + 1);
1346
1436bcd68ee4 Ok some final work on the Calendar control for OS/2... Should work now.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1345
diff changeset
1861 }
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1862 WinDrawText(hpsPaint, -1, (PCH)buf, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1863 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1864
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1865 /* Draw a border around selected day */
1345
e29e24af9b6d Ok get basic drawing working... on the calendar control on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1344
diff changeset
1866 rclPaint = _CalendarDayRect(day + dayofweek + 7, rclPaint);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1867 GpiSetColor(hpsPaint, CLR_DARKGRAY);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1868 _Top(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1869 _Left(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1870 /* With shadow */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1871 GpiSetColor(hpsPaint, CLR_WHITE);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1872 _Right(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1873 _Bottom(hpsPaint, rclPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1874
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1875 WinEndPaint(hpsPaint);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1876
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1877 return (MRESULT)TRUE;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1878 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1879 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1880 if(oldproc)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1881 return oldproc(hWnd, msg, mp1, mp2);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1882 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1883
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1884 return WinDefWindowProc(hWnd, msg, mp1, mp2);
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1885 }
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1886
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
1887
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1888 /* This procedure handles drawing of a status border */
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1889 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
1890 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1891 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1892
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1893 if(msg == WM_MOUSEMOVE && _wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1894 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1895
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1896 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1897 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1898 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1899
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1900 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1901 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1902 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1903 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1904 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1905 RECTL rclPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1906 char buf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1907
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1908 hpsPaint = WinBeginPaint(hWnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1909 WinQueryWindowRect(hWnd, &rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1910 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1911
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1912 GpiSetColor(hpsPaint, CLR_DARKGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1913 _Top(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1914 _Left(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1915
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1916 GpiSetColor(hpsPaint, CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1917 _Right(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1918 _Bottom(hpsPaint, rclPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1919
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
1920 WinQueryWindowText(hWnd, 1024, (PSZ)buf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1921 rclPaint.xLeft += 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1922 rclPaint.xRight--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1923 rclPaint.yTop--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1924 rclPaint.yBottom++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1925
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1926 GpiSetColor(hpsPaint, CLR_BLACK);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
1927 WinDrawText(hpsPaint, -1, (PCH)buf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1928 WinEndPaint(hpsPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1929
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1930 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1931 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1932 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1933 return myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1934 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1935
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1936 return WinDefWindowProc(hWnd, msg, mp1, mp2);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1937 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
1938
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1939 /* 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
1940 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
1941 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1942 PFNWP *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1943
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1944 if(msg == WM_MOUSEMOVE &&_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1945 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1946
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1947 if(blah && *blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1948 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1949 PFNWP myfunc = *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1950
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1951 return myfunc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1952 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1953
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
1954 return WinDefWindowProc(hWnd, msg, mp1, mp2);
531
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1955 }
79696a852401 Added DW_POINTER_DEFAULT, this will return the pointer to the default
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 530
diff changeset
1956
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1957 /* This procedure handles scrollbox */
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1958 MRESULT EXPENTRY _scrollwndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
1959 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1960 switch(msg)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1961 {
849
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1962 case WM_PAINT:
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1963 {
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1964 HPS hpsPaint;
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1965 RECTL rclPaint;
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1966
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1967 hpsPaint = WinBeginPaint(hWnd, 0, 0);
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1968 WinQueryWindowRect(hWnd, &rclPaint);
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1969 WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY);
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1970 WinEndPaint(hpsPaint);
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1971
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1972 break;
39a74ebfdd0d Added WM_PAINT to the scrollbox window procedure to get rid of the dead area between the 2 scrollbars.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 848
diff changeset
1973 }
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1974 case WM_HSCROLL:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1975 case WM_VSCROLL:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1976 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1977 MPARAM res;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1978 int *pos, min, max, page, which = SHORT2FROMMP(mp2);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1979 HWND handle, client = WinWindowFromID(hWnd, FID_CLIENT);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1980 HWND box = (HWND)dw_window_get_data(hWnd, "_dw_resizebox");
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1981 HWND hscroll = WinWindowFromID(hWnd, FID_HORZSCROLL);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1982 HWND vscroll = WinWindowFromID(hWnd, FID_VERTSCROLL);
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1983 int hpos = dw_scrollbar_get_pos(hscroll);
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1984 int vpos = dw_scrollbar_get_pos(vscroll);
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1985 int cy = (int)dw_window_get_data(hWnd, "_dw_cy");
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1986 RECTL rect;
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1987
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1988 WinQueryWindowRect(client, &rect);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1989
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1990 if(msg == WM_VSCROLL)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1991 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1992 page = rect.yTop - rect.yBottom;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1993 handle = vscroll;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
1994 pos = &vpos;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1995 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1996 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1997 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1998 page = rect.xRight - rect.xLeft;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
1999 handle = hscroll;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2000 pos = &hpos;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2001 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2002
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2003 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2004 min = SHORT1FROMMP(res);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2005 max = SHORT2FROMMP(res);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2006
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2007 switch(which)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2008 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2009 case SB_SLIDERTRACK:
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2010 *pos = SHORT1FROMMP(mp2);
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2011 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2012 case SB_LINEUP:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2013 (*pos)--;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2014 if(*pos < min)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2015 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2016 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2017 case SB_LINEDOWN:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2018 (*pos)++;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2019 if(*pos > max)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2020 *pos = max;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2021 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2022 case SB_PAGEUP:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2023 (*pos) -= page;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2024 if(*pos < min)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2025 *pos = min;
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2026 break;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2027 case SB_PAGEDOWN:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2028 (*pos) += page;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2029 if(*pos > max)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2030 *pos = max;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2031 break;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2032 }
847
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2033 WinSendMsg(handle, SBM_SETPOS, (MPARAM)*pos, 0);
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2034 /* Position the scrolled box */
2663f23c88a5 Basics of scrolling working on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 846
diff changeset
2035 WinSetWindowPos(box, HWND_TOP, -hpos, -(cy - vpos), 0, 0, SWP_MOVE);
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2036 break;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2037 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2038 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
2039 return WinDefWindowProc(hWnd, msg, mp1, mp2);
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2040 }
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
2041
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2042 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
2043 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2044 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2045
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2046 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2047
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2048 /* These are the window classes which can
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2049 * obtain input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2050 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2051 if(strncmp(tmpbuf, "#3", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2052 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2053 /* Generate click on default item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2054 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2055
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2056 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2057 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2058 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2059 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2060 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2061 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2062
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2063 /* Make sure it's the right window, and the right ID */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2064 if(tmp->window == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2065 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2066 clickfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2067 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2068 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2069 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2070 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2071 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2072 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2073 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2074 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2075 WinSetFocus(HWND_DESKTOP, handle);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2076 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
2077
1315
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2078 #define ENTRY_CUT 60901
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2079 #define ENTRY_COPY 60902
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2080 #define ENTRY_PASTE 60903
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2081 #define ENTRY_UNDO 60904
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2082 #define ENTRY_SALL 60905
55
b6948eac375a Sync with the latest dynamic windows, tree fixes, and other miscellaneous
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 54
diff changeset
2083
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2084 /* Originally just intended for entryfields, it now serves as a generic
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2085 * procedure for handling TAB presses to change input focus on controls.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2086 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2087 MRESULT EXPENTRY _entryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2088 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2089 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2090 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2091 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2092
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2093 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2094 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2095
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2096 WinQueryClassName(hWnd, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2097
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2098 /* These are the window classes which should get a menu */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2099 if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2100 strncmp(tmpbuf, "#6", 3)==0 || /* Entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2101 strncmp(tmpbuf, "#10", 4)==0 || /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2102 strncmp(tmpbuf, "#32", 4)==0) /* Spinbutton */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2103 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2104 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2105 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2106 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2107 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2108 HMENUI hwndMenu = dw_menu_new(0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2109 long x, y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2110
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2111 if(strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2112 {
1315
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2113 dw_menu_append_item(hwndMenu, "Undo", ENTRY_UNDO, 0L, TRUE, -1, 0L);
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2114 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, -1, 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2115 }
1315
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2116 dw_menu_append_item(hwndMenu, "Copy", ENTRY_COPY, 0L, TRUE, -1, 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2117 if((strncmp(tmpbuf, "#10", 4)!=0 && !dw_window_get_data(hWnd, "_dw_disabled")) || (strncmp(tmpbuf, "#10", 4)==0 && !WinSendMsg(hWnd, MLM_QUERYREADONLY, 0, 0)))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2118 {
1315
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2119 dw_menu_append_item(hwndMenu, "Cut", ENTRY_CUT, 0L, TRUE, -1, 0L);
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2120 dw_menu_append_item(hwndMenu, "Paste", ENTRY_PASTE, 0L, TRUE, -1, 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2121 }
1315
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2122 dw_menu_append_item(hwndMenu, "", 0L, 0L, TRUE, -1, 0L);
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
2123 dw_menu_append_item(hwndMenu, "Select All", ENTRY_SALL, 0L, TRUE, -1, 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2124
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2125 WinSetFocus(HWND_DESKTOP, hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2126 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2127 dw_menu_popup(&hwndMenu, hWnd, x, y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2128 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2129 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2130 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2131 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2132 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2133
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2134 /* MLE */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2135 if(strncmp(tmpbuf, "#10", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2136 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2137 switch(command)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2138 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2139 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2140 return WinSendMsg(hWnd, MLM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2141 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2142 return WinSendMsg(hWnd, MLM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2143 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2144 return WinSendMsg(hWnd, MLM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2145 case ENTRY_UNDO:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2146 return WinSendMsg(hWnd, MLM_UNDO, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2147 case ENTRY_SALL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2148 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2149 ULONG len = (ULONG)WinSendMsg(hWnd, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2150 return WinSendMsg(hWnd, MLM_SETSEL, 0, (MPARAM)len);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2151 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2152 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2153 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2154 else /* Other */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2155 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2156 HWND handle = hWnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2157
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2158 /* Get the entryfield handle from multi window controls */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2159 if(strncmp(tmpbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2160 handle = WinWindowFromID(hWnd, 667);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2161
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2162 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2163 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2164 switch(command)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2165 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2166 case ENTRY_CUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2167 return WinSendMsg(handle, EM_CUT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2168 case ENTRY_COPY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2169 return WinSendMsg(handle, EM_COPY, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2170 case ENTRY_PASTE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2171 return WinSendMsg(handle, EM_PASTE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2172 case ENTRY_SALL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2173 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2174 LONG len = WinQueryWindowTextLength(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2175 return WinSendMsg(hWnd, EM_SETSEL, MPFROM2SHORT(0, (SHORT)len), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2176 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2177 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2178 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2179 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2180 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2181 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2182 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2183 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2184
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2185 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2186 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2187 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2188 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2189 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2190 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2191 if(strncmp(tmpbuf, "#32", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2192 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2193 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2194 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2195 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2196 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2197 if(strncmp(tmpbuf, "#38", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2198 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2199 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2200 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2201 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2202 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2203 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2204 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2205 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2206 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2207 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2208 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2209 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2210 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2211 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2212 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2213 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2214 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2215 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2216 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2217 /* When you hit escape we get this value and the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2218 * window hangs for reasons unknown. (in an MLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2219 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2220 else if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2221 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2222
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2223 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2224 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2225 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2226 /* If it's a slider... make sure it shows the correct value */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2227 if(strncmp(tmpbuf, "#38", 4)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2228 WinPostMsg(hWnd, WM_USER+7, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2229 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2230 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2231 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2232 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2233 int pos = (int)dw_window_get_data(hWnd, "_dw_slider_value");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2234 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2235 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2236 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2237 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2238 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2239 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2240 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2241 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2242
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2243 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2244 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2245
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2246 return WinDefWindowProc(hWnd, msg, mp1, 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
2247 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2248
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2249 /* 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
2250 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
2251 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2252 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2253
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2254 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2255 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2256 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2257 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2258 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2259 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2260 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2261 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2262 return _entryproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2263 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2264 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2265 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2266 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2267 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2268 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2269 /* A Similar problem to the MLE, if ESC just return */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2270 if(SHORT1FROMMP(mp2) == 283)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2271 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2272 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2273 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2274
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2275 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2276 return blah->oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2277
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2278 return WinDefWindowProc(hWnd, msg, mp1, mp2);
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2279 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2280
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2281 /* 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
2282 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
2283 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2284 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2285 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2286 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2287 if(SHORT2FROMMP(mp2) == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2288 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2289 USHORT pos = SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2290
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2291 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2292 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2293 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2294 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2295 return _entryproc(hWnd, msg, mp1, mp2);
153
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2296 }
a371875d5486 Sync up with the latest F/X sources.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 152
diff changeset
2297
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2298 /* Handle special messages for the spinbutton's entryfield */
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2299 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2300 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2301 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2302 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2303
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2304 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2305 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2306
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2307 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2308 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2309 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2310 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2311 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2312 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2313 case WM_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2314 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2315 return _entryproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2316 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2317
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2318 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2319 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2320
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2321 return WinDefWindowProc(hWnd, msg, mp1, mp2);
156
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2322 }
63258b34e70d Minor changes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 155
diff changeset
2323
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2324 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
2325 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2326 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2327 int range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2328 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2329 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2330 float fnew = (fpos/1000.0)*frange;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2331 return (int)fnew;
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2332 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2333
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2334 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
2335 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2336 int inew, range = _dw_percent_get_range(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2337 if(range)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2338 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2339 float fpos = (float)pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2340 float frange = (float)range;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2341 float fnew = (fpos/frange)*1000.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2342 inew = (int)fnew;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2343 dw_window_set_data(hwnd, "_dw_percent_value", (void *)inew);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2344 }
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2345 }
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2346
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
2347 /* 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
2348 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
2349 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2350 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2351 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2352
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2353 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2354 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2355
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2356 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2357 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2358 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2359 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2360 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2361 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2362 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2363 WinPostMsg(hWnd, WM_USER+7, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2364 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2365 case WM_USER+7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2366 WinSendMsg(hWnd, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)_dw_int_pos(hWnd));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2367 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2368 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2369
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2370 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2371 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2372
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2373 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2374 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2375
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2376 /* Handle correct painting of a combobox with the WS_CLIPCHILDREN
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2377 * flag enabled, and also handle TABs to switch input focus.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2378 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2379 MRESULT EXPENTRY _comboproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2380 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2381 WindowData *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2382 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2383
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2384 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2385 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2386
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2387 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2388 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2389 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2390 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2391 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2392 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2393 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2394 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2395 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2396 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2397 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2398 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2399 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2400 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2401 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2402 else if(SHORT1FROMMP(mp2) == '\r' && blah && blah->clickdefault)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2403 _click_default(blah->clickdefault);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2404 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2405 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2406 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2407 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2408 if(dw_window_get_data(hWnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2409 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2410 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2411 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2412 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2413 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2414 if(_run_event(hWnd, msg, mp1, mp2) == (MRESULT)TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2415 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2416 _run_event(hWnd, WM_SETFOCUS, (MPARAM)FALSE, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2417 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2418 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2419 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2420 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2421 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2422 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2423 HWND entry, frame = (HWND)dw_window_get_data(hWnd, "_dw_combo_box"), parent = WinQueryWindow(frame, QW_PARENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2424 HPS hpsPaint;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2425 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2426 unsigned long width, height, thumbheight = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2427 ULONG color;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2428
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2429 if((entry = (HWND)dw_window_get_data(hWnd, "_dw_comboentry")) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2430 dw_window_get_pos_size(entry, 0, 0, 0, &thumbheight);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2431
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2432 if(!thumbheight)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2433 thumbheight = WinQuerySysValue(HWND_DESKTOP, SV_CYVSCROLLARROW);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2434
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2435 /* Add 6 because it has a thick border like the entryfield */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2436 thumbheight += 6;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2437
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2438 color = (ULONG)dw_window_get_data(parent, "_dw_fore");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2439 dw_window_get_pos_size(hWnd, 0, 0, &width, &height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2440
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2441 if(height > thumbheight)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2442 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2443 hpsPaint = WinGetPS(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2444 if(color)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2445 GpiSetColor(hpsPaint, _internal_color(color-1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2446 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2447 GpiSetColor(hpsPaint, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2448
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2449 ptl.x = ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2450 GpiMove(hpsPaint, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2451
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2452 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2453 ptl.y = height - thumbheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2454 GpiBox(hpsPaint, DRO_FILL, &ptl, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2455
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2456 WinReleasePS(hpsPaint);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2457 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2458 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2459 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2460 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2461 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2462 return oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2463
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2464 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2465 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2466
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2467 void _GetPPFont(HWND hwnd, char *buff)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2468 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2469 ULONG AttrFound;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2470 BYTE AttrValue[128];
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2471 ULONG cbRetLen;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2472
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2473 cbRetLen = WinQueryPresParam(hwnd,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2474 PP_FONTNAMESIZE,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2475 0,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2476 &AttrFound,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2477 sizeof(AttrValue),
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2478 &AttrValue,
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2479 QPF_NOINHERIT);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2480
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2481 if(PP_FONTNAMESIZE == AttrFound && cbRetLen)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2482 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2483 memcpy(buff, AttrValue, cbRetLen);
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2484 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2485 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2486
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
2487 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
2488 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2489 MPARAM res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2490 int min, max, page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2491
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2492 if(which == SB_SLIDERTRACK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2493 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2494
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2495 pos = dw_scrollbar_get_pos(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2496 res = WinSendMsg(handle, SBM_QUERYRANGE, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2497
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2498 min = SHORT1FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2499 max = SHORT2FROMMP(res);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2500 page = (int)dw_window_get_data(handle, "_dw_scrollbar_visible");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2501
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2502 switch(which)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2503 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2504 case SB_LINEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2505 pos = pos - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2506 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2507 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2508 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2509 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2510 case SB_LINEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2511 pos = pos + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2512 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2513 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2514 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2515 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2516 case SB_PAGEUP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2517 pos = pos - page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2518 if(pos < min)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2519 pos = min;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2520 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2521 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2522 case SB_PAGEDOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2523 pos = pos + page;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2524 if(pos > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2525 pos = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2526 dw_scrollbar_set_pos(handle, pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2527 return pos;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2528 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2529 return -1;
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
2530 }
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
2531
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2532 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
2533 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2534 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2535 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2536 hwndEmph = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2537 pCoreEmph = NULL;
314
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2538 }
41b890c649e7 Fixed a container emphasis problem when no context menus are created.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 311
diff changeset
2539
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
2540 /* 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
2541 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
2542 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2543 HWND menuowner = NULLHANDLE, lastowner = (HWND)dw_window_get_data(handle, "_dw_owner");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2544 int menubar = (int)dw_window_get_data(handle, "_dw_menubar");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2545
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2546 /* Find the toplevel window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2547 while(!menubar && (menuowner = (HWND)dw_window_get_data(lastowner, "_dw_owner")) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2548 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2549 menubar = (int)dw_window_get_data(lastowner, "_dw_menubar");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2550 lastowner = menuowner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2551 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2552 if(menuowner && menubar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2553 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2554 HWND client = WinWindowFromID(menuowner, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2555
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2556 return client ? client : menuowner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2557 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2558 return 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
2559 }
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
2560
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2561 MRESULT EXPENTRY _run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
2562 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2563 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2564 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2565 ULONG origmsg = msg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2566
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2567 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2568 msg = WM_BUTTON1DOWN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2569 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2570 msg = WM_BUTTON1UP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2571 if(msg == WM_VSCROLL || msg == WM_HSCROLL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2572 msg = WM_CONTROL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2573
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2574 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2575 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2576 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2577 if(tmp->message == msg || msg == WM_CONTROL || tmp->message == WM_USER+1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2578 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2579 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2580 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2581 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2582 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2583 if((mp2 && tmp->message == WM_SETFOCUS) || (!mp2 && tmp->message == WM_USER+1))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2584 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2585 int (* API setfocusfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2586
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2587 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2588 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2589 result = setfocusfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2590 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2591 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2592 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2593 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2594 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2595 case WM_TIMER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2596 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2597 int (* API timerfunc)(void *) = (int (* API)(void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2598 if(tmp->id == (int)mp1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2599 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2600 if(!timerfunc(tmp->data))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2601 dw_timer_disconnect(tmp->id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2602 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2603 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2604 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2605 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2606 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2607 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2608 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2609 int (* API sizefunc)(HWND, int, int, void *) = (int (* API)(HWND, int, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2610
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2611 if((hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd) && SHORT1FROMMP(mp2) && SHORT2FROMMP(mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2612 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2613 result = sizefunc(tmp->window, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2614 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2615 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2616 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2617 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2618 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2619 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2620 POINTS pts = (*((POINTS*)&mp1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2621 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2622
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2623 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2624 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2625 int button = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2626
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2627 switch(origmsg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2628 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2629 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2630 button = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2631 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2632 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2633 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2634 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2635 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2636 button = 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2637 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2638 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2639
963
ea356c38f7b6 Fixed a coordinate system issue with the button press handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 962
diff changeset
2640 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);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2641 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2642 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2643 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2644 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2645 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2646 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2647 POINTS pts = (*((POINTS*)&mp1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2648 int (* API buttonfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2649
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2650 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2651 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2652 int button = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2653
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2654 switch(origmsg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2655 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2656 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2657 button = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2658 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2659 case WM_BUTTON2UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2660 button = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2661 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2662 case WM_BUTTON3UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2663 button = 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2664 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2665 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2666
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2667 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);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2668 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2669 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2670 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2671 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2672 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2673 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2674 int (* API motionfunc)(HWND, int, int, int, void *) = (int (* API)(HWND, int, int, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2675
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2676 if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2677 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2678 int keys = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2679 SHORT x = SHORT1FROMMP(mp1), y = SHORT2FROMMP(mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2680
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2681 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2682 keys = DW_BUTTON1_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2683 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2684 keys |= DW_BUTTON2_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2685 if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2686 keys |= DW_BUTTON3_MASK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2687
956
a3e4cebf3c99 Fixed incorrectly using _get_frame_height() instead of _get_height() which resulted
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 906
diff changeset
2688 result = motionfunc(tmp->window, x, _get_height(hWnd) - y, keys, tmp->data);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2689 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2690 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2691 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2692 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2693 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2694 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2695 int (* API keypressfunc)(HWND, char, int, int, void *) = (int (* API)(HWND, char, int, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2696
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2697 if((hWnd == tmp->window || _toplevel_window(hWnd) == tmp->window) && !(SHORT1FROMMP(mp1) & KC_KEYUP))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2698 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2699 int vk;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2700 char ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2701
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2702 if(SHORT1FROMMP(mp1) & KC_CHAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2703 ch = (char)SHORT1FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2704 if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2705 vk = SHORT2FROMMP(mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2706 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2707 vk = SHORT1FROMMP(mp2) + 128;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2708
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2709 /* This is a hack to fix shift presses showing
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2710 * up as tabs!
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2711 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2712 if(ch == '\t' && !(SHORT1FROMMP(mp1) & KC_CHAR))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2713 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2714 ch = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2715 vk = VK_SHIFT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2716 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2717
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2718 result = keypressfunc(tmp->window, ch, vk,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2719 SHORT1FROMMP(mp1) & (KC_ALT | KC_SHIFT | KC_CTRL), tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2720 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2721 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2722 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2723 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2724 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2725 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2726 int (* API closefunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2727
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2728 if(hWnd == tmp->window || hWnd == WinWindowFromID(tmp->window, FID_CLIENT))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2729 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2730 result = closefunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2731 if(result)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2732 result = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2733 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2734 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2735 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2736 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2737 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2738 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2739 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2740 DWExpose exp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2741 int (* API exposefunc)(HWND, DWExpose *, void *) = (int (* API)(HWND, DWExpose *, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2742 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2743
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2744 if(hWnd == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2745 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2746 int height = _get_height(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2747
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2748 hps = WinBeginPaint(hWnd, 0L, &rc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2749 exp.x = rc.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2750 exp.y = height - rc.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2751 exp.width = rc.xRight - rc. xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2752 exp.height = rc.yTop - rc.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2753 result = exposefunc(hWnd, &exp, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2754 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2755 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2756 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2757 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2758 case WM_COMMAND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2759 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2760 int (* API clickfunc)(HWND, void *) = (int (* API)(HWND, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2761 ULONG command = COMMANDMSG(&msg)->cmd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2762
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2763 if(tmp->id && command == tmp->id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2764 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2765 HWND menuowner = _menu_owner(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2766
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2767 if(menuowner == hWnd || menuowner == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2768 {
1367
a595e368a393 Menu clicked callbacks on OS/2 and Windows should pass the menu ID as the window handle...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1364
diff changeset
2769 result = clickfunc((HWND)tmp->id, tmp->data);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2770 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2771 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2772 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2773 else if(tmp->window < 65536 && command == tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2774 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2775 result = clickfunc(popup ? popup : tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2776 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2777 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2778 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2779 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2780 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2781 if(origmsg == WM_VSCROLL || origmsg == WM_HSCROLL || tmp->message == SHORT2FROMMP(mp1) ||
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2782 (tmp->message == SLN_SLIDERTRACK && SHORT2FROMMP(mp1) == SLN_CHANGE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2783 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2784 int svar = SLN_SLIDERTRACK;
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2785 int id = SHORT1FROMMP(mp1);
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2786 HWND notifyhwnd = dw_window_from_id(hWnd, id);
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2787
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2788 if(origmsg == WM_CONTROL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2789 svar = SHORT2FROMMP(mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2790
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2791 switch(svar)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2792 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2793 case CN_ENTER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2794 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2795 int (* API containerselectfunc)(HWND, char *, void *) = (int (* API)(HWND, char *, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2796 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2797
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2798 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2799 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2800 PRECORDCORE pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2801
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2802 pre = ((PNOTIFYRECORDENTER)mp2)->pRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2803 if(pre)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2804 text = (char *)pre->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2805 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2806
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2807 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2808 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2809 result = containerselectfunc(tmp->window, text, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2810 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2811 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2812 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2813 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2814 case CN_EXPANDTREE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2815 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2816 int (* API treeexpandfunc)(HWND, HTREEITEM, void *) = (int (* API)(HWND, HTREEITEM, void *))tmp->signalfunction;
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2817
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2818 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2819 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2820 result = treeexpandfunc(tmp->window, (HTREEITEM)mp2, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2821 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2822 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2823 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2824 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2825 case CN_CONTEXTMENU:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2826 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2827 int (* API containercontextfunc)(HWND, char *, int, int, void *, void *) = (int (* API)(HWND, char *, int, int, void *, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2828 char *text = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2829 void *user = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2830 LONG x,y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2831
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2832 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2833 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2834 PCNRITEM pci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2835
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2836 pci = (PCNRITEM)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2837
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2838 text = (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2839 user = pci->user;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2840 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2841
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2842 dw_pointer_query_pos(&x, &y);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2843
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2844 if(tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2845 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2846 int container = (int)dw_window_get_data(tmp->window, "_dw_container");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2847
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2848 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2849 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2850 if(!container)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2851 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2852 NOTIFYRECORDEMPHASIS pre;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2853
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2854 dw_tree_item_select(tmp->window, (HTREEITEM)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2855 pre.pRecord = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2856 pre.fEmphasisMask = CRA_CURSORED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2857 pre.hwndCnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2858 _run_event(hWnd, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2859 pre.pRecord->flRecordAttr |= CRA_CURSORED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2860 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2861 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2862 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2863 if(pCoreEmph)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2864 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2865 hwndEmph = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2866 pCoreEmph = mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2867 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2868 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2869 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2870 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2871 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2872 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2873 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2874 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2875 case CN_EMPHASIS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2876 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2877 PNOTIFYRECORDEMPHASIS pre = (PNOTIFYRECORDEMPHASIS)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2878 static int emph_recurse = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2879
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2880 if(!emph_recurse)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2881 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2882 emph_recurse = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2883
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2884 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2885 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2886 if(tmp->window == pre->hwndCnr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2887 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2888 PCNRITEM pci = (PCNRITEM)pre->pRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2889
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2890 if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2891 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2892 int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2893
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2894 if(dw_window_get_data(tmp->window, "_dw_container"))
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2895 result = treeselectfunc(tmp->window, 0, (char *)pci->rc.pszIcon, tmp->data, 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2896 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2897 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2898 if(lasthcnr == tmp->window && lastitem == (HWND)pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2899 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2900 lasthcnr = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2901 lastitem = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2902 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2903 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2904 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2905 lasthcnr = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2906 lastitem = (HWND)pci;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2907 result = treeselectfunc(tmp->window, (HTREEITEM)pci, (char *)pci->rc.pszIcon, tmp->data, pci->user);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2908 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2909 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2910 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2911 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2912 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2913 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2914 emph_recurse = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2915 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2916 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2917 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2918 case LN_SELECT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2919 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2920 char classbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2921
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
2922 WinQueryClassName(tmp->window, 99, (PCH)classbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2923
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2924 if(strncmp(classbuf, "#38", 4) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2925 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2926 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2927
1197
cad6f7aa421c Fixed a couple slight issues with the last commit.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1196
diff changeset
2928 if(tmp->window == hWnd || tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2929 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2930 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2931 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2932 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2933 if(lastvalue != ulValue || lasthwnd != tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2934 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2935 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2936 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2937 lasthwnd = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2938 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2939 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2940 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2941 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2942 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2943 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2944 int (* API listboxselectfunc)(HWND, int, void *) = (int (* API )(HWND, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2945 static int _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2946
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2947 if(_recursing == 0 && (tmp->window == notifyhwnd || (!id && tmp->window == (HWND)mp2)))
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2948 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2949 char buf1[500];
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
2950 int index = dw_listbox_selected(tmp->window);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2951
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2952 dw_listbox_get_text(tmp->window, index, buf1, 500);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2953
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2954 _recursing = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2955
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2956 if(id && strncmp(classbuf, "#2", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2957 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2958 char *buf2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2959
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2960 buf2 = dw_window_get_text(tmp->window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2961
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2962 /* This is to make sure the listboxselect function doesn't
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2963 * get called if the user is modifying the entry text.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2964 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2965 if(buf2 && *buf2 && *buf1 && strncmp(buf1, buf2, 500) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2966 result = listboxselectfunc(tmp->window, index, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2967
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2968 if(buf2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2969 free(buf2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2970 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2971 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2972 result = listboxselectfunc(tmp->window, index, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2973
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2974 _recursing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2975 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2976 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2977 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2978 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2979 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2980 case SLN_SLIDERTRACK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2981 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2982 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2983
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2984 if(origmsg == WM_CONTROL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2985 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2986 /* Handle Slider control */
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
2987 if(tmp->window == hWnd || tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2988 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2989 static int lastvalue = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2990 static HWND lasthwnd = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2991 int ulValue = (int)WinSendMsg(tmp->window, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2992 if(lastvalue != ulValue || lasthwnd != tmp->window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2993 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2994 dw_window_set_data(tmp->window, "_dw_slider_value", (void *)ulValue);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2995 result = valuechangedfunc(tmp->window, ulValue, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2996 lastvalue = ulValue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2997 lasthwnd = tmp->window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2998 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
2999 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3000 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3001 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3002 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3003 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3004 /* Handle scrollbar control */
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
3005 if(tmp->window > 65535 && tmp->window == notifyhwnd)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3006 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3007 int pos = _HandleScroller(tmp->window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3008
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3009 if(pos > -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3010 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3011 dw_window_set_data(tmp->window, "_dw_scrollbar_value", (void *)pos);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3012 result = valuechangedfunc(tmp->window, pos, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3013 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3014 result = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3015 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3016 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3017 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3018 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3019 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3020 case BKN_PAGESELECTED:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3021 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3022 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3023
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3024 if(psn && tmp->window == psn->hwndBook)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3025 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3026 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3027
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3028 result = switchpagefunc(tmp->window, psn->ulPageIdNew, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3029 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3030 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3031 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3032 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3033 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3034 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3035 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3036 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3037 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3038
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3039 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3040 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3041
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3042 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3043 return (MRESULT)result;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3044 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3045
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
3046 /* 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
3047 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
3048 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3049 HWND button = (HWND)dw_window_get_data(window, "_dw_red_spin");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3050 long red, green, blue;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3051
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3052 red = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3053 button = (HWND)dw_window_get_data(window, "_dw_green_spin");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3054 green = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3055 button = (HWND)dw_window_get_data(window, "_dw_blue_spin");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3056 blue = dw_spinbutton_get_pos(button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3057
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3058 return DW_RGB(red, green, blue);
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
3059 }
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
3060
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
3061 /* 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
3062 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
3063 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3064 HWND button = (HWND)dw_window_get_data(window, "_dw_red_spin");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3065 dw_window_set_data(window, "_dw_updating", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3066 dw_spinbutton_set_pos(button, DW_RED_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3067 button = (HWND)dw_window_get_data(window, "_dw_green_spin");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3068 dw_spinbutton_set_pos(button, DW_GREEN_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3069 button = (HWND)dw_window_get_data(window, "_dw_blue_spin");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3070 dw_spinbutton_set_pos(button, DW_BLUE_VALUE(value));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3071 dw_window_set_data(window, "_dw_updating", NULL);
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
3072 }
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
3073
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
3074 /* 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
3075 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
3076 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3077 WinSendMsg(col, 0x0602, MPFROMLONG(_os2_color(value)), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3078 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3079 WinSendMsg(col, 0x1384, MPFROMLONG(_os2_color(value)), 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
3080 }
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
3081
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3082 /* Handles control messages sent to the box (owner). */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3083 MRESULT EXPENTRY _controlproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3084 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3085 Box *blah = WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3086
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3087 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3088 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3089 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3090 if(_wndproc(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3091 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3092 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3093 case WM_VSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3094 case WM_HSCROLL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3095 if(_run_event(hWnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3096 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3097 HWND window = WinWindowFromID(hWnd, (ULONG)mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3098 _HandleScroller(window, (int)SHORT1FROMMP(mp2), (int)SHORT2FROMMP(mp2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3099 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3100 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3101 /* Handles Color Selection control messages */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3102 case 0x0601:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3103 case 0x130C:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3104 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3105 HWND window = (HWND)dw_window_get_data(hWnd, "_dw_window");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3106 unsigned long val = (unsigned long)mp1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3107
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3108 if(window)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3109 _dw_color_spin_set(window, DW_RGB((val & 0xFF0000) >> 16, (val & 0xFF00) >> 8, val & 0xFF));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3110 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3111 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3112 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3113 if((SHORT2FROMMP(mp1) == SPBN_CHANGE || SHORT2FROMMP(mp1) == SPBN_ENDSPIN))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3114 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3115 HWND window = (HWND)dw_window_get_data(hWnd, "_dw_window");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3116
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3117 if(window && !dw_window_get_data(window, "_dw_updating"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3118 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3119 unsigned long val = _dw_color_spin_get(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3120 HWND col = (HWND)dw_window_get_data(window, "_dw_col");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3121
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3122 _dw_col_set(col, val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3123 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3124 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3125 _run_event(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3126 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3127 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3128
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3129 if(blah && blah->oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3130 return blah->oldproc(hWnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3131
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3132 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3133 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3134
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3135 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3136 MRESULT EXPENTRY _wndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3137 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3138 int result = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3139 static int command_active = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3140 void (* API windowfunc)(PVOID) = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3141
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3142 if(!command_active)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3143 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3144 /* Make sure we don't end up in infinite recursion */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3145 command_active = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3146
1357
46c3bcd25b53 Convert WM_ACTIVATE to WM_SETFOCUS for top-level windows on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1354
diff changeset
3147 if(msg == WM_ACTIVATE)
1361
324812debcc9 Missed a couple .DEF file references on OS/2 and...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1358
diff changeset
3148 result = (int)_run_event((HWND)mp2, WM_SETFOCUS, 0, mp1);
1357
46c3bcd25b53 Convert WM_ACTIVATE to WM_SETFOCUS for top-level windows on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1354
diff changeset
3149 else
46c3bcd25b53 Convert WM_ACTIVATE to WM_SETFOCUS for top-level windows on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1354
diff changeset
3150 result = (int)_run_event(hWnd, msg, mp1, mp2);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3151
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3152 command_active = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3153 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3154
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3155 /* Now that any handlers are done... do normal processing */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3156 switch( msg )
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3157 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3158 case WM_ERASEBACKGROUND:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3159 return 0;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3160
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3161 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3162 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3163 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3164 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3165
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3166 hps = WinBeginPaint( hWnd, 0L, &rc );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3167 WinEndPaint( hps );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3168 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3169 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3170
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3171 case WM_SIZE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3172 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3173 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3174
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3175 if(!SHORT1FROMMP(mp2) && !SHORT2FROMMP(mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3176 return (MPARAM)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3177
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3178 if(mybox && mybox->flags != DW_MINIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3179 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3180 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3181 * CPU load.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3182 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3183 WinShowWindow(hWnd, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3184
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
3185 if(mybox->items)
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
3186 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SWP_MOVE | SWP_SIZE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3187
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3188 _do_resize(mybox, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3189
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3190 WinShowWindow(hWnd, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3191 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3192 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3193 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3194 case WM_MINMAXFRAME:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3195 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3196 Box *mybox = (Box *)WinQueryWindowPtr(hWnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3197 SWP *swp = (SWP *)mp1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3198
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3199 if(mybox && (swp->fl & SWP_MINIMIZE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3200 mybox->flags = DW_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3201
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3202 if(mybox && (swp->fl & SWP_RESTORE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3203 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3204 if(!mybox->titlebar && mybox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3205 WinSetParent(mybox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3206 mybox->flags = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3207 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3208
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3209 if(mybox && (swp->fl & (SWP_MAXIMIZE | SWP_RESTORE)))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3210 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3211 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3212 SWP swp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3213
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3214 WinQueryWindowPos(swp->hwnd, &swp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3215
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3216 if(swp2.cx == swp->cx && swp2.cy == swp->cy)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3217 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3218
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3219 mybox->flags = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3220
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3221 /* Hide the window when recalculating to reduce
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3222 * CPU load.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3223 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3224 WinShowWindow(hWnd, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3225
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3226 _do_resize(mybox, swp->cx, swp->cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3227
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3228 if(mybox->count == 1 && mybox->items[0].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3229 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3230 mybox = (Box *)WinQueryWindowPtr(mybox->items[0].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3231
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3232 for(z=0;z<mybox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3233 _check_resize_notebook(mybox->items[z].hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3234
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3235 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3236
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3237 WinShowWindow(hWnd, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3238 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3239 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3240 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3241 case WM_CONTROL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3242 switch(SHORT2FROMMP(mp1))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3243 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3244 case BKN_PAGESELECTEDPENDING:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3245 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3246 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3247 HWND pagehwnd = (HWND)WinSendMsg(psn->hwndBook, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(psn->ulPageIdNew), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3248 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
3249 long x, y;
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
3250 unsigned long width, height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3251 RECTL rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3252
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3253 if(pagebox && psn->ulPageIdNew != psn->ulPageIdCur)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3254 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3255 dw_window_get_pos_size(psn->hwndBook, &x, &y, &width, &height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3256
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3257 rc.xLeft = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3258 rc.yBottom = y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3259 rc.xRight = x + width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3260 rc.yTop = y + height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3261
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3262 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3263
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3264 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3265 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3266 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3267 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3268 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3269 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3270 case WM_CLOSE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3271 if(result == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3272 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3273 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3274 return (MRESULT)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3275 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3276 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3277 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3278 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3279 HPOINTER pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3280
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3281 if((pointer = (HPOINTER)dw_window_get_data(hWnd, "_dw_pointer")) ||
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3282 (pointer = (HPOINTER)dw_window_get_data(_toplevel_window(hWnd), "_dw_pointer")))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3283 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3284 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3285 return MRFROMSHORT(TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3286 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3287 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3288 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3289 case WM_USER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3290 windowfunc = (void (* API)(void *))mp1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3291
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3292 if(windowfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3293 windowfunc((void *)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3294 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3295 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3296 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3297 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3298 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3299 _shift_focus_back(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3300 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3301 _shift_focus(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3302 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3303 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3304 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3305 case WM_DESTROY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3306 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3307 HWND parent = WinQueryWindow(hWnd, QW_PARENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3308
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3309 /* Free memory before destroying */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3310 if(parent && WinWindowFromID(parent, FID_CLIENT) == hWnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3311 _free_window_memory(parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3312 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3313 _free_window_memory(hWnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3314 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3315 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3316 case WM_MENUEND:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3317 /* Delay removing the signal until we've executed
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3318 * the signal handler.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3319 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3320 WinPostMsg(hWnd, WM_USER+2, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3321 break;
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3322 case WM_DDE_INITIATEACK:
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3323 /* aswer dde server */
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3324 hwndTrayServer = (HWND)mp1;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3325 break;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3326 case WM_BUTTON1DOWN | 0x2000:
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3327 case WM_BUTTON2DOWN | 0x2000:
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3328 case WM_BUTTON3DOWN | 0x2000:
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3329 case WM_BUTTON1UP | 0x2000:
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3330 case WM_BUTTON2UP | 0x2000:
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3331 case WM_BUTTON3UP | 0x2000:
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3332 if(hwndTaskBar)
1233
365f92e85771 Fix for dw_font_text_extents_get() on OS/2 not honoring the font set with dw_pixmap_set_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1226
diff changeset
3333 result = (int)_run_event(hwndTaskBar, msg & ~0x2000, mp1, mp2);
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
3334 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3335 case WM_USER+2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3336 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3337 if(dw_window_get_data((HWND)mp2, "_dw_popup"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3338 _free_menu_data((HWND)mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3339 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3340 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3341
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3342 if(result != -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3343 return (MRESULT)result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3344 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3345 return WinDefWindowProc(hWnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3346 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3347
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3348 void _changebox(Box *thisbox, int percent, int type)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3349 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3350 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3351
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3352 for(z=0;z<thisbox->count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3353 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3354 if(thisbox->items[z].type == TYPEBOX)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3355 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3356 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3357 _changebox(tmp, percent, type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3358 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3359 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3360 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3361 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3362 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3363 if(thisbox->items[z].hsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3364 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3365 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3366 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3367 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3368 if(thisbox->items[z].vsize == SIZEEXPAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3369 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3370 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3371 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3372 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3373 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3374
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3375 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
3376 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3377 float ratio = (float)percent/(float)100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3378 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3379 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3380 Box *tmp = WinQueryWindowPtr(handle1, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3381
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3382 WinShowWindow(handle1, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3383 WinShowWindow(handle2, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3384
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3385 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3386 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3387 int newx = (int)((float)x * ratio) - (SPLITBAR_WIDTH/2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3388
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3389 WinSetWindowPos(handle1, NULLHANDLE, 0, 0, newx, y, SWP_MOVE | SWP_SIZE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3390 _do_resize(tmp, newx - 1, y - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3391
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3392 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3393
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3394 tmp = WinQueryWindowPtr(handle2, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3395
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3396 newx = x - newx - SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3397
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3398 WinSetWindowPos(handle2, NULLHANDLE, x - newx, 0, newx, y, SWP_MOVE | SWP_SIZE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3399 _do_resize(tmp, newx - 1, y - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3400 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3401 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3402 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3403 int newy = (int)((float)y * ratio) - (SPLITBAR_WIDTH/2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3404
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3405 WinSetWindowPos(handle1, NULLHANDLE, 0, y - newy, x, newy, SWP_MOVE | SWP_SIZE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3406 _do_resize(tmp, x - 1, newy - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3407
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3408 tmp = WinQueryWindowPtr(handle2, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3409
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3410 newy = y - newy - SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3411
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3412 WinSetWindowPos(handle2, NULLHANDLE, 0, 0, x, newy, SWP_MOVE | SWP_SIZE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3413 _do_resize(tmp, x - 1, newy - 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3414
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3415 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3416 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3417
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3418 WinShowWindow(handle1, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3419 WinShowWindow(handle2, TRUE);
125
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3420 }
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3421
0d2cbd9d4028 Finished the OS/2 splitbar support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 124
diff changeset
3422
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3423 /* This handles any activity on the splitbars (sizers) */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3424 MRESULT EXPENTRY _splitwndproc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3425 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3426 switch (msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3427 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3428 case WM_ACTIVATE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3429 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3430 return (MRESULT)(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3431
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3432 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3433 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3434 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3435 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3436 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3437 int type = (int)dw_window_get_data(hwnd, "_dw_type");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3438 int start = (int)dw_window_get_data(hwnd, "_dw_start");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3439
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3440 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3441
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3442 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3443
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3444 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3445 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3446 ptl[0].x = rcl.xLeft + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3447 ptl[0].y = rcl.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3448 ptl[1].x = rcl.xRight + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3449 ptl[1].y = rcl.yTop;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3450 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3451 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3452 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3453 ptl[0].x = rcl.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3454 ptl[0].y = rcl.yBottom + start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3455 ptl[1].x = rcl.xRight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3456 ptl[1].y = rcl.yTop + start + 3;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3457 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3458
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3459
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3460 GpiSetColor(hps, CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3461 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3462 GpiBox(hps, DRO_OUTLINEFILL, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3463 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3464 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3465 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3466
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3467 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3468 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3469 int type = (int)dw_window_get_data(hwnd, "_dw_type");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3470
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3471 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3472 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3473 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3474 SPTR_SIZEWE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3475 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3476 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3477 WinSetPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3478 WinQuerySysPointer(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3479 SPTR_SIZENS,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3480 FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3481 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3482 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3483 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3484 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3485 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3486 RECTL rclFrame;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3487 RECTL rclBounds;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3488 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3489 int type = (int)dw_window_get_data(hwnd, "_dw_type");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3490 int start = (int)dw_window_get_data(hwnd, "_dw_start");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3491
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3492 WinQueryWindowRect(hwnd, &rclFrame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3493 WinQueryWindowRect(hwnd, &rclBounds);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3494
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3495 WinMapWindowPoints(hwnd, HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3496 (PPOINTL)&rclBounds, 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3497
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3498
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3499 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3500 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3501 rclFrame.xLeft = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3502 rclFrame.xRight = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3503 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3504 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3505 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3506 rclFrame.yBottom = start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3507 rclFrame.yTop = start + SPLITBAR_WIDTH;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3508 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3509
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3510 if(percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3511 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3512 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3513
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3514 if(rc == TRUE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3515 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3516 int width = (rclBounds.xRight - rclBounds.xLeft);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3517 int height = (rclBounds.yTop - rclBounds.yBottom);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3518
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3519 if(type == DW_HORZ)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3520 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3521 start = rclFrame.xLeft - rclBounds.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3522 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3523 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3524 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3525 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3526 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3527 start = rclFrame.yBottom - rclBounds.yBottom;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3528 if(height - SPLITBAR_WIDTH > 1 && start < height - SPLITBAR_WIDTH)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3529 *percent = 100.0 - (((float)start / (float)(height - SPLITBAR_WIDTH)) * 100.0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3530 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3531 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3532 _handle_splitbar_resize(hwnd, *percent, type, width, height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3533 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3534 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3535 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3536 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3537 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3538 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3539 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3540
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3541 /* Function: BubbleProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3542 * Abstract: Subclass procedure for bubble help
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3543 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3544 MRESULT EXPENTRY _BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3545 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3546 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3547 PFNWP proc = (PFNWP)WinQueryWindowPtr(hwnd, QWL_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3548
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3549 if(proc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3550 res = proc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3551 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3552 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3553
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3554 if(msg == WM_PAINT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3555 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3556 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3557 HPS hpsTemp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3558 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3559 int height, width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3560
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3561 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3562 height = rcl.yTop - rcl.yBottom - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3563 width = rcl.xRight - rcl.xLeft - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3564
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3565 /* Draw a border around the bubble help */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3566 hpsTemp = WinGetPS(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3567 GpiSetColor(hpsTemp, CLR_BLACK);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3568 ptl.x = ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3569 GpiMove(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3570 ptl.x = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3571 ptl.y = height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3572 GpiLine(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3573 ptl.x = ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3574 GpiMove(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3575 ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3576 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3577 GpiLine(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3578 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3579 ptl.y = height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3580 GpiMove(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3581 ptl.x = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3582 ptl.y = height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3583 GpiLine(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3584 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3585 ptl.y = height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3586 GpiMove(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3587 ptl.y = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3588 ptl.x = width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3589 GpiLine(hpsTemp, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3590 WinReleasePS(hpsTemp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3591 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3592 return res;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3593 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3594
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
3595 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
3596 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3597 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3598 HPIXMAP disable = (HPIXMAP)dw_window_get_data(hwnd, "_dw_hpixmap_disabled");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3599 HPOINTER icon = (HPOINTER)dw_window_get_data(hwnd, "_dw_button_icon");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3600 MRESULT res;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3601 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3602 int x = 5, y = 5;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3603
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3604 dw_window_get_pos_size(hwnd, NULL, NULL, &width, &height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3605
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3606 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3607 res = WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3608 res = oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3609
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3610 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3611 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3612 ULONG halftone = DP_NORMAL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3613 HPS hps = WinGetPS(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3614 POINTERINFO pi;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3615 int cx, cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3616
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3617 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3618 halftone = DP_HALFTONED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3619
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3620 cx = width - 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3621 cy = height - 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3622
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3623 if(WinQueryPointerInfo(icon, &pi))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3624 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3625 BITMAPINFOHEADER sl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3626 int newcx = cx, newcy = cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3627
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3628 /* Check the mini icon first */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3629 if(GpiQueryBitmapParameters(pi.hbmMiniColor, &sl))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3630 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3631 if(sl.cx && sl.cy && cx > sl.cx && cy > sl.cy)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3632 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3633 newcx = sl.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3634 newcy = sl.cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3635 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3636 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3637 /* Check the normal icon second */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3638 if(GpiQueryBitmapParameters(pi.hbmColor, &sl))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3639 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3640 if(sl.cx && sl.cy && cx > sl.cx && cy > sl.cy)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3641 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3642 newcx = sl.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3643 newcy = sl.cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3644 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3645 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3646 cx = newcx; cy = newcy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3647 x = (width - cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3648 y = (height - cy)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3649 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3650 WinStretchPointer(hps, x + indent, y - indent, cx, cy, icon, halftone);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3651 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3652 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3653 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3654 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3655 x = (width - pixmap->width)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3656 y = (height - pixmap->height)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3657
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3658 if(disable && dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3659 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, disable, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3660 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3661 dw_pixmap_bitblt(hwnd, 0, x + indent, y + indent, pixmap->width, pixmap->height, 0, pixmap, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3662 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3663 return res;
365
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3664 }
eb86c22a9328 Implemented dw_bitmapbutton_new_from_file() on OS/2, and fixed
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 363
diff changeset
3665
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3666 /* Function: BtProc
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3667 * Abstract: Subclass procedure for buttons
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3668 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3669
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3670 MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3671 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3672 WindowData *blah = WinQueryWindowPtr(hwnd, QWL_USER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3673 PFNWP oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3674
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3675 if(!blah)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3676 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3677
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3678 oldproc = blah->oldproc;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3679
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3680 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3681 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3682 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3683 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3684 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3685 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3686 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3687 return _button_draw(hwnd, msg, mp1, mp2, oldproc, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3688 case BM_SETHILITE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3689 return _button_draw(hwnd, msg, mp1, mp2, oldproc, (int)mp1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3690 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3691 if(mp2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3692 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3693 else
1337
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3694 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3695 /* FIX: Borderless buttons not displaying properly after gaining focus */
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3696 if((WinQueryWindowULong(hwnd, QWL_STYLE) & BS_NOBORDER))
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3697 {
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3698 RECTL rcl;
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3699
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3700 WinQueryWindowRect(hwnd, &rcl);
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3701
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3702 WinInvalidateRect(hwnd, &rcl, FALSE);
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3703 WinPostMsg(hwnd, WM_PAINT, 0, 0);
e32b5e5595cd Temporary fix for borderless buttons on OS/2 not displaying properly...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1332
diff changeset
3704 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3705 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3706 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3707 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3708 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3709 case WM_BUTTON1DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3710 case WM_BUTTON2DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3711 case WM_BUTTON3DBLCLK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3712 if(dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3713 return (MRESULT)FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3714 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3715 case WM_BUTTON1UP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3716 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3717 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3718
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3719 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3720 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3721 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3722 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3723 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3724 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3725 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3726 /* Make sure it's the right window, and the right ID */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3727 if(tmp->window == hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3728 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3729 /* Due to the fact that if we run the function
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3730 * here, finishing actions on the button will occur
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3731 * after we run the signal handler. So we post the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3732 * message so the button can finish what it needs to
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3733 * do before we run our handler.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3734 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3735 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3736 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3737 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3738 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3739 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3740 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3741 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3742 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3743 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3744 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3745 case WM_USER:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3746 {
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3747 SignalHandler *tmp = (SignalHandler *)mp1;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3748 int (* API clickfunc)(HWND, void *) = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3749
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3750 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3751 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3752 clickfunc = (int (* API)(HWND, void *))tmp->signalfunction;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3753
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3754 clickfunc(tmp->window, tmp->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3755 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3756 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3757 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3758 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3759 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3760 /* A button press should also occur for an ENTER or SPACE press
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3761 * while the button has the active input focus.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3762 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3763 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3764 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3765 SignalHandler *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3766
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3767 /* Find any callbacks for this function */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3768 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3769 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3770 if(tmp->message == WM_COMMAND)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3771 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3772 /* Make sure it's the right window, and the right ID */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3773 if(tmp->window == hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3774 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3775 WinPostMsg(hwnd, WM_USER, (MPARAM)tmp, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3776 tmp = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3777 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3778 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3779 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3780 tmp= tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3781 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3782 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3783 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3784 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3785 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3786 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3787 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3788 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3789 WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3790 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3791 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3792 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_LEFT || CHARMSG(&msg)->vkey == VK_UP))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3793 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3794 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3795 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3796 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3797 else if(!(CHARMSG(&msg)->fs & KC_KEYUP) && (CHARMSG(&msg)->vkey == VK_RIGHT || CHARMSG(&msg)->vkey == VK_DOWN))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3798 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3799 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3800 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3801 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3802 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3803 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3804 case 0x041f:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3805 if (hwndBubble)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3806 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3807 WinDestroyWindow(hwndBubble);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3808 hwndBubble = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3809 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3810 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3811
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3812 case 0x041e:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3813
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3814 if(!*blah->bubbletext)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3815 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3816
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3817 if(hwndBubble)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3818 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3819 WinDestroyWindow(hwndBubble);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3820 hwndBubble = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3821 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3822
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3823 if(!hwndBubble)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3824 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3825 HPS hpsTemp = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3826 LONG lHight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3827 LONG lWidth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3828 POINTL txtPointl[TXTBOX_COUNT];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3829 POINTL ptlWork = {0,0};
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3830 ULONG ulColor = CLR_YELLOW;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3831 void *blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3832
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3833 hwndBubbleLast = hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3834 hwndBubble = WinCreateWindow(HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3835 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
3836 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3837 SS_TEXT |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3838 DT_CENTER |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3839 DT_VCENTER,
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3840 0,0,0,0,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3841 HWND_DESKTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3842 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3843 0,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3844 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3845 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3846
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3847 WinSetPresParam(hwndBubble,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3848 PP_FONTNAMESIZE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3849 strlen(DefaultFont)+1,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3850 DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3851
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3852
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3853 WinSetPresParam(hwndBubble,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3854 PP_BACKGROUNDCOLORINDEX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3855 sizeof(ulColor),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3856 &ulColor);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3857
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3858 WinSetWindowText(hwndBubble,
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3859 (PSZ)blah->bubbletext);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3860
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3861 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3862
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3863 hpsTemp = WinGetPS(hwndBubble);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3864 GpiQueryTextBox(hpsTemp,
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3865 strlen(blah->bubbletext),
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
3866 (PCH)blah->bubbletext,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3867 TXTBOX_COUNT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3868 txtPointl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3869 WinReleasePS(hpsTemp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3870
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3871 lWidth = txtPointl[TXTBOX_TOPRIGHT].x -
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3872 txtPointl[TXTBOX_TOPLEFT ].x + 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3873
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3874 lHight = txtPointl[TXTBOX_TOPLEFT].y -
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3875 txtPointl[TXTBOX_BOTTOMLEFT].y + 8;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3876
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3877 ptlWork.y -= lHight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3878
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3879 blah = (void *)WinSubclassWindow(hwndBubble, _BubbleProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3880
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3881 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3882 WinSetWindowPtr(hwndBubble, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3883
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3884 WinSetWindowPos(hwndBubble,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3885 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3886 ptlWork.x,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3887 ptlWork.y,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3888 lWidth,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3889 lHight,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3890 SWP_SIZE | SWP_MOVE | SWP_SHOW);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3891 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3892 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3893 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3894
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3895 if(!oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3896 return WinDefWindowProc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3897 return oldproc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3898 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3899
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3900 MRESULT EXPENTRY _RendProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3901 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3902 int res = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3903 res = (int)_run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3904 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3905 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3906 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3907 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3908 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3909 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3910 case WM_BUTTON1DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3911 case WM_BUTTON2DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3912 case WM_BUTTON3DOWN:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3913 if(res == -1)
963
ea356c38f7b6 Fixed a coordinate system issue with the button press handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 962
diff changeset
3914 WinSetFocus(HWND_DESKTOP, hwnd);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3915 else if(res)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3916 return (MPARAM)TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3917 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3918 return WinDefWindowProc(hwnd, msg, mp1, mp2);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3919 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3920
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3921 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
3922 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3923 WindowData *blah = (WindowData *)WinQueryWindowPtr(hwnd, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3924 PFNWP oldproc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3925
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3926 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3927 oldproc = blah->oldproc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3928
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3929 switch(msg)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3930 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3931 case WM_MOUSEMOVE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3932 if(_wndproc(hwnd, msg, mp1, mp2))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3933 return MPFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3934 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3935 case WM_PAINT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3936 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3937 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3938 RECTL rcl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3939 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3940
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3941 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3942 oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3943
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3944 hps = WinBeginPaint(hwnd, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3945 WinQueryWindowRect(hwnd, &rcl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3946 ptl[0].x = rcl.xLeft + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3947 ptl[0].y = rcl.yBottom + 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3948 ptl[1].x = rcl.xRight - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3949 ptl[1].y = rcl.yTop - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3950
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3951 GpiSetColor(hps, CLR_BLACK);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3952 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3953 GpiBox(hps, DRO_OUTLINE, &ptl[1], 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3954 WinEndPaint(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3955 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3956 return MRFROMSHORT(FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3957 case WM_SETFOCUS:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3958 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3959 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3960 case WM_CHAR:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3961 if(SHORT1FROMMP(mp2) == '\t')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3962 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3963 if(CHARMSG(&msg)->fs & KC_SHIFT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3964 _shift_focus_back(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3965 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3966 _shift_focus(hwnd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3967 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3968 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3969 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3970 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3971
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3972 _run_event(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3973
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3974 if(oldproc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3975 return oldproc(hwnd, msg, mp1, mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3976
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3977 return WinDefWindowProc(hwnd, msg, mp1, mp2);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3978 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
3979
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3980 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3981 * Initializes the Dynamic Windows engine.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3982 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3983 * newthread: True if this is the only thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3984 * False if there is already a message loop running.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3985 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
3986 int API dw_init(int newthread, int argc, char *argv[])
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
3987 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3988 APIRET rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3989 char objnamebuf[300] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
3990
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3991 /* Setup the private data directory */
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3992 if(argc > 0 && argv[0])
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3993 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3994 char *pos = strrchr(argv[0], '\\');
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3995
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3996 /* Just to be safe try the unix style */
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3997 if(!pos)
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3998 pos = strrchr(argv[0], '/');
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
3999
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4000 if(pos)
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4001 strncpy(_dw_exec_dir, argv[0], (size_t)(pos - argv[0]));
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4002 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4003 /* If that failed... just get the current directory */
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4004 if(!_dw_exec_dir[0])
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4005 _getcwd(_dw_exec_dir, MAX_PATH);
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
4006
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4007 if(newthread)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4008 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4009 dwhab = WinInitialize(0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4010 dwhmq = WinCreateMsgQueue(dwhab, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4011 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4012
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4013 rc = WinRegisterClass(dwhab, (PSZ)ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32);
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4014 rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _splitwndproc, 0L, 32);
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4015 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4016
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4017 /* Get the OS/2 version. */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4018 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4019
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4020 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4021
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4022 if(!IS_WARP4())
1075
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4023 DefaultFont = strdup("8.Helv");
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4024 else
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4025 DefaultFont = strdup(DefaultFont);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4026
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4027 /* This is a window that hangs around as long as the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4028 * application does and handles menu messages.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4029 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4030 hwndApp = dw_window_new(HWND_OBJECT, "", 0);
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
4031 /* Attempt to locate a tray server */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4032 WinDdeInitiate(hwndApp, (PSZ)"SystrayServer", (PSZ)"TRAY", NULL);
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4033
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4034 /* Load DLLs for providing extra functionality if available */
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4035 DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"WPCONFIG", &wpconfig);
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4036 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMPRINTF", &pmprintf))
1342
b4a23eab81fa *sighs* tabs again... I really need to figure out how to change the default to spaces.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1341
diff changeset
4037 DosQueryProcAddr(pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4038 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4039 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4040
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4041 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4042 * 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
4043 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4044 void API dw_main(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4045 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4046 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4047
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4048 _dwtid = dw_thread_id();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4049
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4050 while(WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4051 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4052 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4053 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4054 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4055 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4056
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4057 WinDestroyMsgQueue(dwhmq);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4058 WinTerminate(dwhab);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4059 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4060
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4061 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4062 * 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
4063 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
4064 * 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
4065 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4066 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
4067 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4068 QMSG qmsg;
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4069 #ifdef __EMX__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4070 struct timeval tv, start;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4071
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4072 gettimeofday(&start, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4073 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4074
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4075 while(((tv.tv_sec - start.tv_sec)*1000) + ((tv.tv_usec - start.tv_usec)/1000) <= milliseconds)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4076 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4077 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4078 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4079 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4080 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4081 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4082 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4083 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4084 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4085 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4086 gettimeofday(&tv, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4087 }
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
4088 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4089 double start = (double)clock();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4090
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4091 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4092 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4093 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4094 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4095 WinGetMsg(dwhab, &qmsg, 0, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4096 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4097 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4098 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4099 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4100 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4101 DosSleep(1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4102 }
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4103 #endif
37
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4104 }
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4105
360bc6a5f1c9 Sync with latest Dynamic Windows code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 34
diff changeset
4106 /*
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
4107 * 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
4108 */
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
4109 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
4110 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4111 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4112
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4113 _dwtid = dw_thread_id();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4114
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4115 if(WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4116 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4117 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4118 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4119 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4120 }
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
4121 }
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
4122
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
4123 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4124 * Free's memory allocated by dynamic windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4125 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4126 * ptr: Pointer to dynamic windows allocated
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4127 * memory to be free()'d.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4128 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4129 void API dw_free(void *ptr)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4130 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4131 free(ptr);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4132 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4133
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4134 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4135 * Allocates and initializes a dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4136 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4137 * data: User defined data to be passed to functions.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4138 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4139 DWDialog * API dw_dialog_new(void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4140 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4141 DWDialog *tmp = malloc(sizeof(DWDialog));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4142
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4143 tmp->eve = dw_event_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4144 dw_event_reset(tmp->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4145 tmp->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4146 tmp->done = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4147 tmp->result = NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4148
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4149 return tmp;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4150 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4151
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4152 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4153 * Accepts a dialog struct and returns the given data to the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4154 * initial called of dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4155 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4156 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4157 * result: Data to be returned by dw_dialog_wait().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4158 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4159 int API dw_dialog_dismiss(DWDialog *dialog, void *result)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4160 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4161 dialog->result = result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4162 dw_event_post(dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4163 dialog->done = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4164 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4165 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4166
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4167 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4168 * Accepts a dialog struct waits for dw_dialog_dismiss() to be
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4169 * called by a signal handler with the given dialog struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4170 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4171 * dialog: Pointer to a dialog struct aquired by dw_dialog_new).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4172 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4173 void * API dw_dialog_wait(DWDialog *dialog)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4174 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4175 QMSG qmsg;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4176 void *tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4177
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4178 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4179 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4180 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4181 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4182 WinDispatchMsg(dwhab, &qmsg);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4183 if(dialog->done)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4184 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4185 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4186 dw_event_close(&dialog->eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4187 tmp = dialog->result;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4188 free(dialog);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4189 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4190 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4191
1306
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4192 /*
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4193 * Displays a debug message on the console...
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4194 * Parameters:
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4195 * format: printf style format string.
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4196 * ...: Additional variables for use in the format.
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4197 */
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4198 void API dw_debug(char *format, ...)
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4199 {
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4200 va_list args;
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4201 char outbuf[1024];
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4202
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4203 va_start(args, format);
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4204 vsprintf(outbuf, format, args);
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4205 va_end(args);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4206
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4207 if(_PmPrintfString)
1342
b4a23eab81fa *sighs* tabs again... I really need to figure out how to change the default to spaces.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1341
diff changeset
4208 _PmPrintfString(outbuf);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4209 else
1342
b4a23eab81fa *sighs* tabs again... I really need to figure out how to change the default to spaces.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1341
diff changeset
4210 fprintf(stderr, "%s", outbuf);
1306
dbd507f42947 Added dw_debug() logging function which will output a message to the debugging console.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1305
diff changeset
4211 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4212
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4213 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4214 * Displays a Message Box with given text and title..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4215 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4216 * 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
4217 * flags: flags to indicate buttons and icon
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4218 * format: printf style format string.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4219 * ...: Additional variables for use in the format.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4220 */
399
a7a561103eac Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 377
diff changeset
4221 int API dw_messagebox(char *title, int flags, char *format, ...)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4222 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4223 va_list args;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4224 char outbuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4225 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4226
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4227 va_start(args, format);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4228 vsprintf(outbuf, format, args);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4229 va_end(args);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4230
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4231 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, (PSZ)outbuf, (PSZ)title, 0, flags | MB_MOVEABLE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4232 if(rc == MBID_OK)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4233 return DW_MB_RETURN_OK;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4234 else if(rc == MBID_YES)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4235 return DW_MB_RETURN_YES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4236 else if(rc == MBID_NO)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4237 return DW_MB_RETURN_NO;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4238 else if(rc == MBID_CANCEL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4239 return DW_MB_RETURN_CANCEL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4240 else return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4241 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4242
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4243 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4244 * Makes the window topmost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4245 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4246 * 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
4247 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4248 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
4249 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4250 return WinSetWindowPos(handle, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4251 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4252
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4253 /*
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4254 * Makes the window bottommost.
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4255 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4256 * 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
4257 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4258 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
4259 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4260 return WinSetWindowPos(handle, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4261 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4262
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
4263 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4264 * Makes the window visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4265 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4266 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4267 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4268 int API dw_window_show(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4269 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4270 int rc = WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_SHOW);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4271 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4272 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4273
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4274 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4275 WinSetFocus(HWND_DESKTOP, handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4276 _initial_focus(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4277
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4278 /* If this window has a switch list entry make sure it is visible */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4279 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4280 if(hswitch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4281 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4282 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4283 swcntrl.uchVisibility = SWL_VISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4284 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4285 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4286 if(WinWindowFromID(handle, FID_CLIENT))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4287 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4288 WindowData *blah = WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4289
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4290 if(blah && !(blah->flags & DW_OS2_NEW_WINDOW))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4291 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4292 ULONG cx = dw_screen_width(), cy = dw_screen_height();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4293 int newx, newy, changed = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4294 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4295
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4296 blah->flags |= DW_OS2_NEW_WINDOW;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4297
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4298 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4299
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4300 newx = swp.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4301 newy = swp.y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4302
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4303 if((swp.x+swp.cx) > cx)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4304 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4305 newx = (cx - swp.cx)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4306 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4307 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4308 if((swp.y+swp.cy) > cy)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4309 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4310 newy = (cy - swp.cy)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4311 changed = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4312 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4313 if(changed)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4314 WinSetWindowPos(handle, NULLHANDLE, newx, newy, 0, 0, SWP_MOVE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4315 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4316 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4317 return rc;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4318 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4319
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4320 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4321 * 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
4322 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4323 * handle: The window handle to minimize.
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4324 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4325 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
4326 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4327 HWND hwndclient = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4328
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4329 if(hwndclient)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4330 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4331 Box *box = (Box *)WinQueryWindowPtr(hwndclient, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4332
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4333 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4334 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4335 if(!box->titlebar && box->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4336 WinSetParent(box->hwndtitle, handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4337 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4338 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4339
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4340 return WinSetWindowPos(handle, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE);
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4341 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4342
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4343 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4344 * Makes the window invisible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4345 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4346 * handle: The window handle to make visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4347 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4348 int API dw_window_hide(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4349 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4350 HSWITCH hswitch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4351 SWCNTRL swcntrl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4352
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4353 /* If this window has a switch list entry make sure it is invisible */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4354 hswitch = WinQuerySwitchHandle(handle, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4355 if(hswitch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4356 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4357 WinQuerySwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4358 swcntrl.uchVisibility = SWL_INVISIBLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4359 WinChangeSwitchEntry(hswitch, &swcntrl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4360 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4361 return WinShowWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4362 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4363
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4364 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4365 * Destroys a window and all of it's children.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4366 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4367 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4368 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4369 int API dw_window_destroy(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4370 {
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4371 HWND frame, menu, parent;
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4372 Box *thisbox;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4373
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4374 if(!handle)
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4375 return DW_ERROR_UNKNOWN;
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4376
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4377 /* Handle special case for menu handle */
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4378 if(handle < 65536)
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4379 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4380 char buffer[30];
1372
8e27dd96a97e Fixed typo that made the OS/2 code refuse to compile.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1371
diff changeset
4381
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4382 sprintf(buffer, "_dw_id%ld", handle);
1372
8e27dd96a97e Fixed typo that made the OS/2 code refuse to compile.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1371
diff changeset
4383 menu = (HWND)dw_window_get_data(hwndApp, buffer);
8e27dd96a97e Fixed typo that made the OS/2 code refuse to compile.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1371
diff changeset
4384
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4385 if(menu && WinIsWindow(dwhab, menu))
1372
8e27dd96a97e Fixed typo that made the OS/2 code refuse to compile.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1371
diff changeset
4386 return dw_menu_delete_item((HMENUI)menu, handle);
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4387 return DW_ERROR_UNKNOWN;
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4388 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4389
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4390 parent = WinQueryWindow(handle, QW_PARENT);
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
4391 thisbox = WinQueryWindowPtr(parent, QWP_USER);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4392 frame = (HWND)dw_window_get_data(handle, "_dw_combo_box");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4393
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4394 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4395 _free_menu_data(menu);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4396
1332
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4397 /* If it is a desktop window let WM_DESTROY handle it */
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4398 if(parent != desktop)
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4399 {
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4400 /* If the parent box has items...
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4401 * try to remove it from the layout
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4402 */
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4403 if(thisbox && thisbox->count)
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4404 {
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4405 int z, index = -1;
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4406 Item *tmpitem, *thisitem = thisbox->items;
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4407
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4408 for(z=0;z<thisbox->count;z++)
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4409 {
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4410 if(thisitem[z].hwnd == handle)
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4411 index = z;
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4412 }
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4413
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4414 if(index == -1)
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4415 return 0;
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4416
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4417 tmpitem = malloc(sizeof(Item)*(thisbox->count-1));
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4418
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4419 /* Copy all but the current entry to the new list */
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4420 for(z=0;z<index;z++)
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4421 {
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4422 tmpitem[z] = thisitem[z];
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4423 }
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4424 for(z=index+1;z<thisbox->count;z++)
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4425 {
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4426 tmpitem[z-1] = thisitem[z];
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4427 }
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4428
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4429 thisbox->items = tmpitem;
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4430 free(thisitem);
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4431 thisbox->count--;
c0f29ce1a879 Fixed too broad of an if() in dw_window_destroy on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1331
diff changeset
4432 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4433 _free_window_memory(frame ? frame : handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4434 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4435 return WinDestroyWindow(frame ? frame : handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4436 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4437
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
4438 /* 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
4439 * 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
4440 * 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
4441 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4442 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
4443 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4444 HWND client = WinWindowFromID(handle, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4445 HWND window = client ? client : handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4446 Box *mybox = (Box *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4447
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4448 _fix_button_owner(_toplevel_window(handle), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4449 if(window && mybox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4450 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4451 unsigned long width, height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4452
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4453 dw_window_get_pos_size(window, NULL, NULL, &width, &height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4454
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4455 if(mybox->items)
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4456 WinSetWindowPos(mybox->items[0].hwnd, HWND_TOP, 0, 0, width, height, SWP_MOVE | SWP_SIZE);
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4457
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4458 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4459 _do_resize(mybox, width, height);
1020
c63abcab5312 Fix for dw_window_redraw not resetting box position on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1019
diff changeset
4460 WinShowWindow(client && mybox->items ? mybox->items[0].hwnd : handle, TRUE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4461 }
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
4462 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
4463
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4464 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4465 * Changes a window's parent to newparent.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4466 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4467 * handle: The window handle to destroy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4468 * newparent: The window's new parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4469 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4470 void API dw_window_reparent(HWND handle, HWND newparent)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4471 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4472 HWND blah = WinWindowFromID(newparent, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4473 WinSetParent(handle, blah ? blah : newparent, TRUE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4474 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4475
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4476 /* Allows the user to choose a font using the system's font chooser dialog.
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4477 * Parameters:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4478 * currfont: current font
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4479 * Returns:
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4480 * A malloced buffer with the selected font or NULL on error.
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4481 */
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4482 char * API dw_font_choose(char *currfont)
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4483 {
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4484 FONTDLG fd = { 0 };
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4485 char *buf = calloc(1,100);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4486 int size = 9;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4487
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4488 /* Fill in the family name if possible */
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4489 if(currfont)
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4490 {
1233
365f92e85771 Fix for dw_font_text_extents_get() on OS/2 not honoring the font set with dw_pixmap_set_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1226
diff changeset
4491 char *name = strchr(currfont, '.');
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4492 if(name)
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4493 {
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4494 int newsize = atoi(currfont);
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4495 if(newsize > 0)
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4496 size = newsize;
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4497 name++;
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4498 strcpy(buf, name);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4499 strcpy(fd.fAttrs.szFacename, name);
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4500 }
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4501 else
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4502 {
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4503 strcpy(buf, currfont);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4504 strcpy(fd.fAttrs.szFacename, currfont);
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4505 }
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4506 }
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4507
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4508 /* Fill in the font dialog struct */
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4509 fd.cbSize = sizeof(fd);
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4510 fd.hpsScreen = WinGetScreenPS(HWND_DESKTOP);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4511 fd.pszTitle = (PSZ)"Choose Font";
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4512 fd.clrFore = CLR_BLACK;
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4513 fd.clrBack = CLR_WHITE;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4514 fd.pszFamilyname = (PSZ)buf;
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4515 fd.usFamilyBufLen = 100;
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4516 fd.fxPointSize = MAKEFIXED(size,0);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4517 fd.fl = FNTS_INITFROMFATTRS;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4518
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4519 /* Show the dialog and wait for a response */
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4520 if(!WinFontDlg(HWND_DESKTOP, HWND_OBJECT, &fd) || fd.lReturn != DID_OK)
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4521 {
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4522 WinReleasePS(fd.hpsScreen);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4523 free(buf);
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4524 return NULL;
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4525 }
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4526 WinReleasePS(fd.hpsScreen);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4527 /* Figure out what the user selected and return that */
1056
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4528 size = FIXEDINT(fd.fxPointSize);
240bd5fb8453 Ugg... tabs got enabled in my editor and I didn't notice until after I committed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1055
diff changeset
4529 sprintf(buf, "%d.%s", size, fd.fAttrs.szFacename);
1055
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4530 return buf;
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4531 }
140d04226c86 Added dw_font_choose() on OS/2 for 2.1.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1047
diff changeset
4532
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4533 /*
1075
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4534 * Sets the default font used on text based widgets.
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4535 * Parameters:
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4536 * fontname: Font name in Dynamic Windows format.
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4537 */
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4538 void API dw_font_set_default(char *fontname)
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4539 {
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4540 char *oldfont = DefaultFont;
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4541
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4542 DefaultFont = strdup(fontname);
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4543 free(oldfont);
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4544 }
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4545
3d117071a50b Renamed Mac _dw_default_font() to dw_font_set_default() and added it on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1056
diff changeset
4546 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4547 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4548 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4549 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4550 * fontname: Name and size of the font in the form "size.fontname"
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4551 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4552 int API dw_window_set_font(HWND handle, char *fontname)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4553 {
1047
5dbb931bac5a Changed the data names from _dw_entry/_dw_group to _dw_buddy on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1044
diff changeset
4554 HWND group = (HWND)dw_window_get_data(handle, "_dw_buddy");
1044
59343c7493a3 Changes so dw_window_get/set_font() work on groupboxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1035
diff changeset
4555 return WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4556 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4557
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4558 /*
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4559 * Gets the font used by a specified window (widget) handle.
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4560 * Parameters:
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4561 * handle: The window (widget) handle.
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4562 * fontname: Name and size of the font in the form "size.fontname"
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4563 */
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4564 char * API dw_window_get_font(HWND handle)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4565 {
1010
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
4566 char *str = (char *)alloca(50);
1047
5dbb931bac5a Changed the data names from _dw_entry/_dw_group to _dw_buddy on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1044
diff changeset
4567 HWND group = (HWND)dw_window_get_data(handle, "_dw_buddy");
1044
59343c7493a3 Changes so dw_window_get/set_font() work on groupboxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1035
diff changeset
4568 if(str && WinQueryPresParam(group ? group : handle, PP_FONTNAMESIZE, 0, NULL, 50, str, QPF_NOINHERIT))
1010
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
4569 return strdup(str);
9af693aafa93 Attempt at implmenting dw_window_get_font on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1009
diff changeset
4570 return NULL;
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4571 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4572
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4573 /* Internal version */
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4574 int _dw_window_set_color(HWND handle, ULONG fore, ULONG back)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4575 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4576 if((fore & DW_RGB_COLOR) == DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4577 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4578 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4579
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4580 rgb2.bBlue = DW_BLUE_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4581 rgb2.bGreen = DW_GREEN_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4582 rgb2.bRed = DW_RED_VALUE(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4583 rgb2.fcOptions = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4584
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4585 WinSetPresParam(handle, PP_FOREGROUNDCOLOR, sizeof(RGB2), &rgb2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4586
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4587 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4588 else if(fore != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4589 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4590 fore = _internal_color(fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4591
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4592 WinSetPresParam(handle, PP_FOREGROUNDCOLORINDEX, sizeof(ULONG), &fore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4593 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4594 if((back & DW_RGB_COLOR) == DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4595 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4596 RGB2 rgb2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4597
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4598 rgb2.bBlue = DW_BLUE_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4599 rgb2.bGreen = DW_GREEN_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4600 rgb2.bRed = DW_RED_VALUE(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4601 rgb2.fcOptions = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4602
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4603 WinSetPresParam(handle, PP_BACKGROUNDCOLOR, sizeof(RGB2), &rgb2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4604 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4605 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4606 else if(back != DW_CLR_DEFAULT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4607 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4608 back = _internal_color(back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4609
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4610 WinSetPresParam(handle, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4611 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4612 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4613 }
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4614 /*
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4615 * 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
4616 * Parameters:
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4617 * handle: The window (widget) handle.
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4618 * 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
4619 * 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
4620 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4621 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
4622 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4623 dw_window_set_data(handle, "_dw_fore", (void *)(fore+1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4624 dw_window_set_data(handle, "_dw_back", (void *)(back+1));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4625
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4626 return _dw_window_set_color(handle, fore, back);
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
4627 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4628
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4629 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4630 * Sets the font used by a specified window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4631 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4632 * handle: The window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4633 * border: Size of the window border in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4634 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4635 int API dw_window_set_border(HWND handle, int border)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4636 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4637 WinSendMsg(handle, WM_SETBORDERSIZE, MPFROMSHORT(border), MPFROMSHORT(border));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4638 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4639 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4640
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4641 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4642 * Captures the mouse input to this window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4643 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4644 * handle: Handle to receive mouse input.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4645 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4646 void API dw_window_capture(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4647 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4648 WinSetCapture(HWND_DESKTOP, handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4649 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4650
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4651 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4652 * Releases previous mouse capture.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4653 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4654 void API dw_window_release(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4655 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4656 WinSetCapture(HWND_DESKTOP, NULLHANDLE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4657 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4658
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4659 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4660 * Tracks this window movement.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4661 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4662 * handle: Handle to frame to be tracked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4663 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4664 void API dw_window_track(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4665 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4666 WinSendMsg(handle, WM_TRACKFRAME, MPFROMSHORT(TF_MOVE), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4667 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4668
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4669 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4670 * 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
4671 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4672 * 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
4673 * 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
4674 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
4675 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
4676 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4677 HPOINTER pointer = pointertype < 65535 ?
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4678 WinQuerySysPointer(HWND_DESKTOP, pointertype, FALSE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4679 : (HPOINTER)pointertype;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4680
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4681 if(!pointertype)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4682 dw_window_set_data(handle, "_dw_pointer", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4683 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4684 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4685 WinSetPointer(HWND_DESKTOP, pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4686
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4687 if(handle != HWND_DESKTOP)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4688 dw_window_set_data(handle, "_dw_pointer", (void *)pointer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4689 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4690 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4691
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
4692 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4693 * Create a new Window Frame.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4694 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4695 * owner: The Owner's window handle or HWND_DESKTOP.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4696 * title: The Window title.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4697 * flStyle: Style flags, see the PM reference.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4698 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4699 HWND API dw_window_new(HWND hwndOwner, char *title, ULONG flStyle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4700 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4701 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4702 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4703 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4704 ULONG winStyle = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4705
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4706 newbox->pad = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4707 newbox->type = DW_VERT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4708 newbox->count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4709
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4710 flStyle |= FCF_NOBYTEALIGN;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4711
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4712 if(flStyle & DW_FCF_TITLEBAR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4713 newbox->titlebar = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4714 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4715 flStyle |= FCF_TITLEBAR;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4716
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4717 if(!(flStyle & FCF_SHELLPOSITION))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4718 blah->flags |= DW_OS2_NEW_WINDOW;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4719
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4720 if(flStyle & WS_MAXIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4721 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4722 winStyle |= WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4723 flStyle &= ~WS_MAXIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4724 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4725 if(flStyle & WS_MINIMIZED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4726 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4727 winStyle |= WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4728 flStyle &= ~WS_MINIMIZED;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4729 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4730
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4731 hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, (PSZ)ClassName, (PSZ)title, 0L, NULLHANDLE, 0L, &newbox->hwnd);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4732 newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4733 if(!newbox->titlebar && newbox->hwndtitle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4734 WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4735 blah->oldproc = WinSubclassWindow(hwndframe, _sizeproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4736 WinSetWindowPtr(hwndframe, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4737 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4738
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4739 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4740 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4741
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4742 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4743 * Create a new Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4744 * 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
4745 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4746 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4747 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4748 HWND API dw_box_new(int type, int pad)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4749 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4750 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4751
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4752 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4753 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4754 newbox->count = 0;
846
a75e798ee6ed Added initial scrollbox implementation for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 833
diff changeset
4755 newbox->grouphwnd = NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4756
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4757 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4758 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4759 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4760 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4761 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4762 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4763 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4764 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4765 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4766 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4767 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4768
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4769 newbox->oldproc = WinSubclassWindow(newbox->hwnd, _controlproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4770 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4771 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4772 return newbox->hwnd;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4773 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4774
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4775 /*
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4776 * Create a new scroll Box to be packed.
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4777 * Parameters:
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4778 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4779 * pad: Number of pixels to pad around the box.
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4780 */
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4781 HWND API dw_scrollbox_new(int type, int pad)
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4782 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4783 HWND hwndframe, box = dw_box_new(type, pad);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4784 HWND client, tmpbox = dw_box_new(DW_VERT, 0);
1016
b7e7e2bc8085 While debugging an the lack of SELECT event in containers initially....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1010
diff changeset
4785 Box *blah = calloc(sizeof(Box), 1);
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4786 dw_box_pack_start(tmpbox, box, 1, 1, TRUE, TRUE, 0);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4787 hwndframe = WinCreateWindow(HWND_OBJECT, (PSZ)ScrollClassName, NULL, WS_VISIBLE | WS_CLIPCHILDREN,
1016
b7e7e2bc8085 While debugging an the lack of SELECT event in containers initially....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1010
diff changeset
4788 0, 0, 2000, 1000, NULLHANDLE, HWND_TOP, 0, NULL, NULL);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4789 WinCreateWindow(hwndframe, WC_SCROLLBAR, NULL, WS_VISIBLE | SBS_AUTOTRACK | SBS_VERT,
1016
b7e7e2bc8085 While debugging an the lack of SELECT event in containers initially....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1010
diff changeset
4790 0,0,2000,1000, hwndframe, HWND_TOP, FID_VERTSCROLL, NULL, NULL);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4791 WinCreateWindow(hwndframe, WC_SCROLLBAR, NULL, WS_VISIBLE | SBS_AUTOTRACK | SBS_HORZ,
1016
b7e7e2bc8085 While debugging an the lack of SELECT event in containers initially....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1010
diff changeset
4792 0,0,2000,1000, hwndframe, HWND_TOP, FID_HORZSCROLL, NULL, NULL);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4793 client = WinCreateWindow(hwndframe, WC_FRAME, NULL, WS_VISIBLE | WS_CLIPCHILDREN,
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4794 0,0,2000,1000, NULLHANDLE, HWND_TOP, FID_CLIENT, NULL, NULL);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4795 WinSetParent(tmpbox, client, FALSE);
1016
b7e7e2bc8085 While debugging an the lack of SELECT event in containers initially....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1010
diff changeset
4796 WinSetWindowPtr(client, QWP_USER, blah);
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4797 dw_window_set_data(hwndframe, "_dw_resizebox", (void *)tmpbox);
1016
b7e7e2bc8085 While debugging an the lack of SELECT event in containers initially....
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1010
diff changeset
4798 dw_window_set_data(hwndframe, "_dw_box", (void *)box);
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4799 dw_window_set_color(hwndframe, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4800 dw_window_set_color(client, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4801 return hwndframe;
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4802 }
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4803
848
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4804 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4805 * Returns the position of the scrollbar in the scrollbox
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4806 * Parameters:
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4807 * handle: Handle to the scrollbox to be queried.
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4808 * orient: The vertical or horizontal scrollbar.
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4809 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4810 int API dw_scrollbox_get_pos( HWND handle, int orient )
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4811 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4812 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4813
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4814 if(orient == DW_VERT)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4815 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4816 scroll = WinWindowFromID(handle, FID_VERTSCROLL);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4817 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4818 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4819 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4820 scroll = WinWindowFromID(handle, FID_HORZSCROLL);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4821 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4822 return (int)WinSendMsg(scroll, SBM_QUERYPOS, 0, 0);
848
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4823 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4824
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4825 /*
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4826 * Gets the range for the scrollbar in the scrollbox.
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4827 * Parameters:
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4828 * handle: Handle to the scrollbox to be queried.
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4829 * orient: The vertical or horizontal scrollbar.
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4830 */
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4831 int API dw_scrollbox_get_range( HWND handle, int orient )
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4832 {
1009
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4833 HWND scroll;
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4834
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4835 if(orient == DW_VERT)
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4836 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4837 scroll = WinWindowFromID(handle, FID_VERTSCROLL);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4838 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4839 else
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4840 {
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4841 scroll = WinWindowFromID(handle, FID_HORZSCROLL);
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4842 }
f1256b32fd22 Added stub for dw_window_get_font() for OS/2 port
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1000
diff changeset
4843 return SHORT2FROMMP(WinSendMsg(scroll, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), 0));
848
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4844 }
543e591c69a3 Implemented dw_scrollbox_get_pos() and dw_scrollbox_get_range() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 847
diff changeset
4845
833
53b677d126dc Scrollbox cleanups on Windows and added stubs on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 824
diff changeset
4846 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4847 * Create a new Group Box to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4848 * 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
4849 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4850 * pad: Number of pixels to pad around the box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4851 * title: Text to be displayined in the group outline.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4852 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4853 HWND API dw_groupbox_new(int type, int pad, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4854 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4855 Box *newbox = calloc(1, sizeof(Box));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4856 newbox->pad = pad;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4857 newbox->type = type;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4858 newbox->count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4859
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4860 newbox->hwnd = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4861 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4862 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4863 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4864 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4865 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4866 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4867 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4868 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4869 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4870 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4871
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4872 newbox->grouphwnd = WinCreateWindow(newbox->hwnd,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4873 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
4874 (PSZ)title,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4875 WS_VISIBLE | SS_GROUPBOX |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4876 WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4877 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4878 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4879 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4880 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4881 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4882 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4883
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4884 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4885 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4886 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4887 dw_window_set_font(newbox->grouphwnd, DefaultFont);
1233
365f92e85771 Fix for dw_font_text_extents_get() on OS/2 not honoring the font set with dw_pixmap_set_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1226
diff changeset
4888 dw_window_set_data(newbox->hwnd, "_dw_buddy", (void *)newbox->grouphwnd);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4889 return newbox->hwnd;
3
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 /*
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4893 * 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
4894 * Parameters:
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4895 * 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
4896 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4897 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
4898 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4899 HWND hwndframe;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4900 ULONG back = CLR_DARKGRAY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4901
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4902 hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4903 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4904 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4905 WS_VISIBLE | WS_CLIPCHILDREN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4906 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4907 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4908 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4909 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4910 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4911 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4912 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4913 /* Make the MDI Client area the same color as Windows and Unix */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4914 WinSetPresParam(hwndframe, PP_BACKGROUNDCOLORINDEX, sizeof(ULONG), &back);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4915 return hwndframe;
14
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4916 }
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4917
176cee043f1b Lots of Windows and Unix bug fixes.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 12
diff changeset
4918 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4919 * Create a bitmap object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4920 * 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
4921 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4922 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4923 HWND API dw_bitmap_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4924 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4925 return WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4926 WC_STATIC,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4927 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4928 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4929 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4930 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4931 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4932 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4933 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4934 NULL);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4935 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4936
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4937 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4938 * Create a notebook object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4939 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4940 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4941 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4942 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4943 HWND API dw_notebook_new(ULONG id, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4944 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4945 ULONG flags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4946 HWND tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4947
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4948 if(top)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4949 flags = BKS_MAJORTABTOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4950 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4951 flags = BKS_MAJORTABBOTTOM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4952
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4953 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4954 WC_NOTEBOOK,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4955 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4956 WS_VISIBLE |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4957 #ifdef BKS_TABBEDDIALOG
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4958 BKS_TABBEDDIALOG |
475
1547e8c327d9 Remove some compiler warnings under EMX.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 470
diff changeset
4959 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4960 flags,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4961 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4962 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4963 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4964 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4965 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4966 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4967
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4968 /* Fix tab sizes on Warp 3 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4969 if(!IS_WARP4())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4970 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4971 /* best sizes to be determined by trial and error */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4972 WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4973 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4974
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4975 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4976 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4977 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4978
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4979 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4980 * Create a menu object to be popped up.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4981 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4982 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4983 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4984 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
4985 HMENUI API dw_menu_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
4986 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4987 HMENUI tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4988 WC_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4989 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4990 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4991 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4992 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4993 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4994 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4995 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
4996 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
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 menubar on a window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5002 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5003 * location: Handle of a window frame to be attached to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5004 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5005 HMENUI API dw_menubar_new(HWND location)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5006 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5007 HMENUI tmp = WinCreateWindow(location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5008 WC_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5009 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5010 WS_VISIBLE | MS_ACTIONBAR,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5011 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5012 location,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5013 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5014 FID_MENU,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5015 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5016 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5017 dw_window_set_data(tmp, "_dw_owner", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5018 dw_window_set_data(tmp, "_dw_menubar", (void *)location);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5019 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5020 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5021
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5022 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5023 * Destroys a menu created with dw_menubar_new or dw_menu_new.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5024 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5025 * menu: Handle of a menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5026 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5027 void API dw_menu_destroy(HMENUI *menu)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5028 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5029 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5030 WinDestroyWindow(*menu);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5031 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5032
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5033 /* Internal function to make sure menu ID isn't in use */
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5034 int _menuid_allocated(int id)
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5035 {
1310
47dbe605a03f Removed an unused variable in the new code on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1309
diff changeset
5036 SignalHandler *tmp = Root;
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5037
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5038 while(tmp)
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5039 {
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5040 if(tmp->id == id)
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5041 return TRUE;
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5042 tmp = tmp->next;
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5043 }
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5044 return FALSE;
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5045 }
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5046
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5047 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5048 * Adds a menuitem or submenu to an existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5049 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5050 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5051 * title: The title text on the menu item to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5052 * id: An ID to be used for message passing.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5053 * flags: Extended attributes to set on the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5054 * end: If TRUE memu is positioned at the end of the menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5055 * check: If TRUE menu is "check"able.
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5056 * flags: Extended attributes to set on the menu.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5057 * submenu: Handle to an existing menu to be a submenu or NULL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5058 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5059 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
5060 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5061 MENUITEM miSubMenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5062 char buffer[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5063 int is_checked, is_disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5064
1311
5f3ce2b1e82d Fixed DW_MENU_POPUP failing on OS/2 due to an invalid sanity check.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1310
diff changeset
5065 if ( !menux || !WinIsWindow(dwhab, menux) )
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5066 return NULLHANDLE;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5067
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5068 if ( end )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5069 miSubMenu.iPosition=MIT_END;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5070 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5071 miSubMenu.iPosition=0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5072 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5073 * Handle flags
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5074 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5075 miSubMenu.afAttribute = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5076 is_checked = (flags & DW_MIS_CHECKED) ? 1 : 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5077 if ( is_checked )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5078 miSubMenu.afAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5079 is_disabled = (flags & DW_MIS_DISABLED) ? 1 : 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5080 if ( is_disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5081 miSubMenu.afAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5082
1305
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5083 if (title && *title)
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5084 {
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5085 /* Code to autogenerate a menu ID if not specified or invalid
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5086 * First pool is smaller for transient popup menus
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5087 */
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5088 if(id == (ULONG)-1)
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5089 {
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5090 static ULONG tempid = 61000;
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5091
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5092 tempid++;
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5093 id = tempid;
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5094
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5095 if(tempid > 65500)
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5096 tempid = 61000;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5097 }
1315
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
5098 /* Special internal case */
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5099 else if(id > 60000 && check == -1)
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5100 {
1315
9c585eaacb22 Moved the menu IDs used for entryfields on OS/2 into the resevered
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1314
diff changeset
5101 check = 0;
1316
3475887f9445 Fixed tabs inserted by my editor on OS/2 again.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1315
diff changeset
5102 }
1305
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5103 /* Second pool is larger for more static windows */
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5104 else if(!id || id >= 30000)
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5105 {
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5106 static ULONG menuid = 30000;
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5107
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5108 do
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5109 {
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5110 menuid++;
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5111 if(menuid > 60000)
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5112 menuid = 30000;
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5113 }
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
5114 while(_menuid_allocated(menuid));
1305
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5115 id = menuid;
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5116 }
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5117 miSubMenu.afStyle = MIS_TEXT;
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5118 }
18a31ab94e3d Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1304
diff changeset
5119 else
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5120 miSubMenu.afStyle = MIS_SEPARATOR;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5121 miSubMenu.id=id;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5122 miSubMenu.hwndSubMenu = submenu;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5123 miSubMenu.hItem=NULLHANDLE;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5124
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5125 WinSendMsg(menux, MM_INSERTITEM, MPFROMP(&miSubMenu), MPFROMP(title));
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5126
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5127 sprintf(buffer, "_dw_id%d", (int)id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5128 dw_window_set_data(hwndApp, buffer, (void *)menux);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5129 sprintf(buffer, "_dw_checkable%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5130 dw_window_set_data( hwndApp, buffer, (void *)check );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5131 sprintf(buffer, "_dw_ischecked%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5132 dw_window_set_data( hwndApp, buffer, (void *)is_checked );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5133 sprintf(buffer, "_dw_isdisabled%ld", id);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5134 dw_window_set_data( hwndApp, buffer, (void *)is_disabled );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5135
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5136 if ( submenu )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5137 dw_window_set_data(submenu, "_dw_owner", (void *)menux);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5138 return (HWND)id;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5139 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5140
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5141 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5142 * Sets the state of a menu item check.
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5143 * Deprecated; use dw_menu_item_set_state()
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5144 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5145 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5146 * id: Menuitem id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5147 * check: TRUE for checked FALSE for not checked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5148 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5149 void API dw_menu_item_set_check(HMENUI menux, unsigned long id, int check)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5150 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5151 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5152 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED));
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5153 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5154 WinSendMsg(menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE),MPFROM2SHORT(MIA_CHECKED, 0));
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5155 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5156
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5157 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5158 * Sets the state of a menu item.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5159 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5160 * menu: The handle to the existing menu.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5161 * id: Menuitem id.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5162 * flags: DW_MIS_ENABLED/DW_MIS_DISABLED
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5163 * DW_MIS_CHECKED/DW_MIS_UNCHECKED
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5164 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5165 void API dw_menu_item_set_state( HMENUI menux, unsigned long id, unsigned long state)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5166 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5167 char buffer1[30],buffer2[30];
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5168 int check;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5169 int disabled;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5170 USHORT fAttribute=0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5171
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5172 sprintf( buffer1, "_dw_ischecked%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5173 check = (int)dw_window_get_data( hwndApp, buffer1 );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5174 sprintf( buffer2, "_dw_isdisabled%ld", id );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5175 disabled = (int)dw_window_get_data( hwndApp, buffer2 );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5176
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5177 if ( (state & DW_MIS_CHECKED) || (state & DW_MIS_UNCHECKED) )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5178 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5179 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5180 * If we are changing state of "checked" base our setting on the passed flag...
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5181 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5182 if ( state & DW_MIS_CHECKED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5183 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5184 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5185 check = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5186 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5187 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5188 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5189 check = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5190 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5191 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5192 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5193 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5194 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5195 * ...otherwise base our setting on the current "checked" state.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5196 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5197 if ( check )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5198 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5199 fAttribute |= MIA_CHECKED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5200 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5201 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5202 if ( (state & DW_MIS_ENABLED) || (state & DW_MIS_DISABLED) )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5203 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5204 if ( state & DW_MIS_DISABLED )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5205 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5206 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5207 disabled = 1;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5208 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5209 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5210 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5211 disabled = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5212 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5213 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5214 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5215 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5216 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5217 * ...otherwise base our setting on the current "disabled" state.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5218 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5219 if ( disabled )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5220 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5221 fAttribute |= MIA_DISABLED;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5222 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5223 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5224 WinSendMsg( menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), MPFROM2SHORT( MIA_CHECKED|MIA_DISABLED, fAttribute ) );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5225 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5226 * Keep our internal checked state consistent
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5227 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5228 dw_window_set_data( hwndApp, buffer1, (void *)check );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5229 dw_window_set_data( hwndApp, buffer2, (void *)disabled );
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5230 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5231
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5232 /*
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5233 * Deletes the menu item specified
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5234 * Parameters:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5235 * menu: The handle to the menu in which the item was appended.
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5236 * id: Menuitem id.
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5237 * Returns:
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5238 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure.
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5239 */
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5240 int API dw_menu_delete_item(HMENUI menux, unsigned long id)
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5241 {
1377
b6249d66404c Cleanup signal handlers when calling dw_menu_delete_item() on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1372
diff changeset
5242 if(id < 65536 && menux)
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5243 {
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5244 WinSendMsg(menux, MM_DELETEITEM, MPFROM2SHORT(id, FALSE), 0);
1377
b6249d66404c Cleanup signal handlers when calling dw_menu_delete_item() on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1372
diff changeset
5245 /* If the ID was autogenerated it is safe to remove it */
b6249d66404c Cleanup signal handlers when calling dw_menu_delete_item() on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1372
diff changeset
5246 if(id >= 30000)
b6249d66404c Cleanup signal handlers when calling dw_menu_delete_item() on OS/2 and Windows...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1372
diff changeset
5247 dw_signal_disconnect_by_window((HWND)id);
1371
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5248 return DW_ERROR_NONE;
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5249 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5250 return DW_ERROR_UNKNOWN;
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5251 }
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5252
896347a9be19 Initial versions of dw_menu_delete_item() on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1367
diff changeset
5253 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5254 * Pops up a context menu at given x and y coordinates.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5255 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5256 * menu: The handle the the existing menu.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5257 * parent: Handle to the window initiating the popup.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5258 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5259 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5260 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5261 void API dw_menu_popup(HMENUI *menu, HWND parent, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5262 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5263 if(menu)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5264 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5265 popup = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5266 dw_window_set_data(*menu, "_dw_popup", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5267 WinPopupMenu(HWND_DESKTOP, parent, *menu, x, dw_screen_height() - y, 0, PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_VCONSTRAIN | PU_HCONSTRAIN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5268 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5269 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5270
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5271 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5272 * Returns the current X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5273 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5274 * x: Pointer to variable to store X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5275 * y: Pointer to variable to store Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5276 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5277 void API dw_pointer_query_pos(long *x, long *y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5278 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5279 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5280
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5281 WinQueryPointerPos(HWND_DESKTOP, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5282 if(x && y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5283 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5284 *x = ptl.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5285 *y = dw_screen_height() - ptl.y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5286 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5287 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5288
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5289 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5290 * Sets the X and Y coordinates of the mouse pointer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5291 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5292 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5293 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5294 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5295 void API dw_pointer_set_pos(long x, long y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5296 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5297 WinSetPointerPos(HWND_DESKTOP, x, dw_screen_height() - y);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5298 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5299
310
77105fe19c1f Removed obsolete dw_container_set_view() function.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 307
diff changeset
5300
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5301 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5302 * Create a container object to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5303 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5304 * id: An ID to be used for getting the resource from the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5305 * resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5306 */
350
2216e65ad2ae Removed slider flags and container selection flags from the header file.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 347
diff changeset
5307 HWND API dw_container_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5308 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5309 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5310 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5311 WC_CONTAINER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5312 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5313 WS_VISIBLE | CCS_READONLY |
1029
60d6d2c87116 Switched back to CCS_EXTENDSEL from CCS_MULTIPLESEL...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1024
diff changeset
5314 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5315 CCS_AUTOPOSITION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5316 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5317 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5318 HWND_TOP,
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
5319 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5320 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5321 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5322 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5323 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5324 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5325 dw_window_set_data(tmp, "_dw_container", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5326 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5327 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5328
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5329 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5330 * 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
5331 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5332 * 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
5333 * 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
5334 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5335 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
5336 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5337 CNRINFO cnrinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5338 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5339 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5340 WC_CONTAINER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5341 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5342 WS_VISIBLE | CCS_READONLY |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5343 CCS_SINGLESEL | CCS_AUTOPOSITION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5344 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5345 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5346 HWND_TOP,
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
5347 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5348 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5349 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5350
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5351 cnrinfo.flWindowAttr = CV_TREE | CA_TREELINE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5352 cnrinfo.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5353 cnrinfo.slBitmapOrIcon.cy = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5354 cnrinfo.cyLineSpacing = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5355 cnrinfo.cxTreeIndent = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5356 cnrinfo.cxTreeLine = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5357
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5358 WinSendMsg(tmp, CM_SETCNRINFO, &cnrinfo, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5359 CMA_LINESPACING | CMA_CXTREEINDENT | CMA_CXTREELINE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5360 blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5361 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5362 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5363 return tmp;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5364 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5365
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
5366 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5367 * Create a new static text window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5368 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5369 * 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
5370 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5371 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5372 HWND API dw_text_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5373 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5374 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5375 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5376 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5377 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5378 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5379 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5380 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5381 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5382 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5383 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5384 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5385 blah->oldproc = WinSubclassWindow(tmp, _textproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5386 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5387 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5388 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5389 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5390 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5391
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5392 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5393 * 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
5394 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5395 * 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
5396 * 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
5397 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5398 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
5399 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5400 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5401 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5402 WC_STATIC,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5403 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5404 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5405 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5406 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5407 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5408 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5409 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5410 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5411 blah->oldproc = WinSubclassWindow(tmp, _statusproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5412 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5413 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5414 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5415 return tmp;
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5416 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5417
154
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5418 #ifndef MLS_LIMITVSCROLL
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5419 #define MLS_LIMITVSCROLL 0x00000080L
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5420 #endif
7f8fcce45bdd Fixed EMX building.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 153
diff changeset
5421
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
5422 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5423 * Create a new Multiline Editbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5424 * 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
5425 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5426 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5427 HWND API dw_mle_new(ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5428 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5429 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5430 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5431 WC_MLE,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5432 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5433 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5434 MLS_BORDER | MLS_IGNORETAB |
1325
552da4dea7d1 Don't default the MLE to read only on OS/2 since other platforms don't.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1322
diff changeset
5435 MLS_VSCROLL |
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5436 MLS_LIMITVSCROLL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5437 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5438 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5439 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5440 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5441 NULL,
996
69cf9f26e899 Removed some code I accidentally commited to the OS/2 module.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 995
diff changeset
5442 NULL);
1233
365f92e85771 Fix for dw_font_text_extents_get() on OS/2 not honoring the font set with dw_pixmap_set_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1226
diff changeset
5443 WinSendMsg(tmp, MLM_FORMAT, (MPARAM)MLFIE_NOTRANS, 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5444 blah->oldproc = WinSubclassWindow(tmp, _mleproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5445 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5446 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5447 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5448 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5449
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5450 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5451 * Create a new Entryfield window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5452 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5453 * 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
5454 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5455 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5456 HWND API dw_entryfield_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5457 {
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
5458
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5459 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5460 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5461 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5462 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5463 WS_VISIBLE | ES_MARGIN |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5464 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5465 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5466 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5467 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5468 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5469 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5470 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5471 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5472 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5473 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5474 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5475 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5476 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5477
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5478 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5479 * Create a new Entryfield (password) window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5480 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5481 * 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
5482 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5483 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5484 HWND API dw_entryfield_password_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5485 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5486 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5487 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5488 WC_ENTRYFIELD,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5489 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5490 WS_VISIBLE | ES_MARGIN | ES_UNREADABLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5491 ES_AUTOSCROLL | WS_TABSTOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5492 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5493 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5494 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5495 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5496 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5497 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5498 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5499 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5500 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5501 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5502 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5503 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5504
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5505 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5506 * Create a new Combobox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5507 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5508 * 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
5509 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5510 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5511 HWND API dw_combobox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5512 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5513 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5514 HWND frame = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5515 HWND tmp = WinCreateWindow(frame,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5516 WC_COMBOBOX,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5517 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5518 WS_VISIBLE | CBS_DROPDOWN | WS_GROUP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5519 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5520 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5521 HWND_TOP,
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
5522 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5523 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5524 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5525 HENUM henum = WinBeginEnumWindows(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5526 HWND child, last = NULLHANDLE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5527
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5528 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5529 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5530 WindowData *moreblah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5531 moreblah->oldproc = WinSubclassWindow(child, _comboentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5532 WinSetWindowPtr(child, QWP_USER, moreblah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5533 dw_window_set_color(child, DW_CLR_BLACK, DW_CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5534 last = child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5535 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5536 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5537 blah->oldproc = WinSubclassWindow(tmp, _comboproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5538 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5539 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5540 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5541 dw_window_set_data(tmp, "_dw_comboentry", (void *)last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5542 dw_window_set_data(tmp, "_dw_combo_box", (void *)frame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5543 WinSetOwner(tmp, frame);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5544 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5545 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5546
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5547 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5548 * Create a new button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5549 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5550 * 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
5551 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5552 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5553 HWND API dw_button_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5554 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5555 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5556 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5557 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5558 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5559 WS_VISIBLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5560 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5561 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5562 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5563 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5564 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5565 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5566
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5567 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5568
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5569 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5570 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5571 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5572 return tmp;
3
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 /* Function: GenResIDStr
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5576 ** Abstract: Generate string '#nnnn' for a given ID for using with Button
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5577 ** controls
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5578 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5579
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5580 void _GenResIDStr(CHAR *buff, ULONG ulID)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5581 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5582 char *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5583 int slen = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5584
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5585 *buff++ = '#';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5586
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5587 str = buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5588
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5589 do
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5590 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5591 *str++ = (ulID % 10) + '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5592 ulID /= 10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5593 slen++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5594 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5595 while(ulID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5596
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5597 *str-- = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5598
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5599 for(; str > buff; str--, buff++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5600 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5601 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5602 *str ^= *buff;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5603 *buff ^= *str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5604 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5605 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5606
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5607
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5608 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5609 * Create a new bitmap button window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5610 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5611 * text: Bubble help text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5612 * id: An ID of a bitmap in the resource file.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5613 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5614 HWND API dw_bitmapbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5615 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5616 char idbuf[256], *name = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5617 HWND tmp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5618 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5619 HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5620
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5621 if(!icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5622 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5623 name = idbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5624 _GenResIDStr(idbuf, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5625 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5626
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5627 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5628 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5629 (PSZ)name,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5630 WS_VISIBLE | BS_PUSHBUTTON |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5631 BS_NOPOINTERFOCUS | BS_AUTOSIZE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5632 (icon ? 0 : BS_BITMAP),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5633 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5634 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5635 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5636 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5637 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5638 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5639
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5640 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5641 blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5642 blah->old = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5643
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5644 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5645
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5646 if(icon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5647 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5648 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5649 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5650 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5651
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5652 /*
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5653 * 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
5654 * Parameters:
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5655 * 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
5656 * 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
5657 * 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
5658 * 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
5659 * (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
5660 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
5661 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
5662 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5663 WindowData *blah = calloc(1, sizeof(WindowData));
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5664 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5665 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5666 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5667 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5668 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5669 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5670 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5671 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5672 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5673 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5674 NULL);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5675 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5676 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5677 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5678
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5679 if(file && (pixmap = calloc(1,sizeof(struct _hpixmap))))
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5680 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5681 int z, j, lim, len;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5682 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5683
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5684 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5685
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5686 /* check if we can read from this file (it exists and read permission) */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5687 if(access(file, 04) == 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5688 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5689 len = strlen( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5690 if(len > 4)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5691 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5692 if(stricmp(file + len - 4, ".ico") == 0)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5693 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5694 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5695 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5696 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5697 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5698 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5699 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5700 /* Try with .ico extension first...*/
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5701 strcat(file, ".ico");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5702 if(access(file, 04) == 0)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5703 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5704 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5705 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5706 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5707 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5708 if(access(file, 04) == 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5709 _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5710 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5711 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5712
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5713 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5714 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5715 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5716 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5717 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5718 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5719 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5720 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5721 disabled = dw_pixmap_new(tmp, pixmap->width, pixmap->height, dw_color_depth_get());
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5722 dw_pixmap_bitblt(0, disabled, 0, 0, pixmap->width, pixmap->height, 0, pixmap, 0, 0);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5723
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5724 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5725 dw_color_foreground_set(DW_CLR_PALEGRAY);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5726 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5727 for(j=0;j<pixmap->height;j++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5728 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5729 int mod = j%2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5730
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5731 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5732 dw_draw_point(0, disabled, (z*2)+mod, j);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5733 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5734 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5735 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5736 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5737
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5738 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5739 blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5740 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5741
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5742 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5743
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5744 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5745 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5746 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5747 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5748 dw_window_set_data(tmp, "_dw_hpixmap", (void *)pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5749 dw_window_set_data(tmp, "_dw_hpixmap_disabled", (void *)disabled);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5750 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5751 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5752 return tmp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5753 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5754
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5755 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5756 * Create a new bitmap button window (widget) to be packed from data.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5757 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5758 * text: Bubble help text to be displayed.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5759 * id: An ID to be used with dw_window_from_id() or 0L.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5760 * data: The contents of the image
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5761 * (BMP or ICO on OS/2 or Windows, XPM on Unix)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5762 * len: length of str
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5763 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5764 HWND API dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5765 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5766 FILE *fp;
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5767 WindowData *blah = calloc(1, sizeof(WindowData));
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5768 HWND tmp = WinCreateWindow(HWND_OBJECT,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5769 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5770 NULL,
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5771 WS_VISIBLE | BS_PUSHBUTTON |
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5772 BS_AUTOSIZE | BS_NOPOINTERFOCUS,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5773 0,0,2000,1000,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5774 NULLHANDLE,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5775 HWND_TOP,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5776 id,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5777 NULL,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5778 NULL);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5779 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5780 HPIXMAP pixmap = NULL, disabled = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5781 HPOINTER icon = 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5782
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5783 if ( ( pixmap = calloc( 1, sizeof(struct _hpixmap) ) ) )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5784 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5785 int z, j, lim;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5786 LONG fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5787 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5788 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5789 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5790 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5791 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5792 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5793 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5794 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5795 if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5796 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5797 _load_bitmap_file( file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5798 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5799 else /* otherwise its assumed to be an ico */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5800 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5801 icon = WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5802 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5803 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5804 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5805 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5806 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5807 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5808 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5809 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5810 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5811
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5812 if ( icon )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5813 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5814 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5815 pixmap = NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5816 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5817 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5818 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5819 /* Create a disabled style pixmap */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5820 disabled = dw_pixmap_new(tmp, pixmap->width, pixmap->height, dw_color_depth_get());
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5821 dw_pixmap_bitblt(0, disabled, 0, 0, pixmap->width, pixmap->height, 0, pixmap, 0, 0);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5822
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5823 fore = _foreground;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5824 dw_color_foreground_set(DW_CLR_PALEGRAY);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5825 lim = pixmap->width/2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5826 for(j=0;j<pixmap->height;j++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5827 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5828 int mod = j%2;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5829
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5830 for(z=0;z<lim;z++)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5831 dw_draw_point(0, disabled, (z*2)+mod, j);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5832 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5833 _foreground = fore;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5834 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5835 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5836
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5837 strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5838 blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0';
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5839 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5840
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
5841 WinSetWindowPtr(tmp, QWP_USER, blah);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5842
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5843 if(icon)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5844 dw_window_set_data(tmp, "_dw_button_icon", (void *)icon);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5845 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5846 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5847 dw_window_set_data(tmp, "_dw_hpixmap", (void *)pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5848 dw_window_set_data(tmp, "_dw_hpixmap_disabled", (void *)disabled);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5849 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5850 dw_window_set_data(tmp, "_dw_bitmapbutton", (void *)1);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
5851 return tmp;
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5852 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5853
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
5854 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5855 * Create a new spinbutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5856 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5857 * 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
5858 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5859 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5860 HWND API dw_spinbutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5861 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5862 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5863 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5864 WC_SPINBUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5865 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5866 WS_VISIBLE | SPBS_MASTER,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5867 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5868 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5869 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5870 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5871 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5872 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5873 HWND entry = _find_entryfield(tmp);
1024
814e4767277f Set initial range of spin buttons to -65536 to 65536 on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1020
diff changeset
5874 WinSendMsg(tmp, SPBM_SETLIMITS, MPFROMLONG(65536), MPFROMLONG(-65536));
814e4767277f Set initial range of spin buttons to -65536 to 65536 on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1020
diff changeset
5875 WinSendMsg(tmp, SPBM_SETCURRENTVALUE, MPFROMLONG(atoi(text)), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5876 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5877 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5878 blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5879 blah->oldproc = WinSubclassWindow(entry, _spinentryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5880 WinSetWindowPtr(entry, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5881 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5882 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE);
1047
5dbb931bac5a Changed the data names from _dw_entry/_dw_group to _dw_buddy on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1044
diff changeset
5883 dw_window_set_data(tmp, "_dw_buddy", (void *)entry);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5884 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5885 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5886
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5887 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5888 * Create a new radiobutton window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5889 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5890 * 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
5891 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5892 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5893 HWND API dw_radiobutton_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5894 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5895 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5896 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5897 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5898 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5899 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5900 BS_AUTORADIOBUTTON,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5901 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5902 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5903 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5904 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5905 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5906 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5907 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5908 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5909 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5910 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5911 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5912 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5913
94
7c3eef54c98c Popup menu handler fix for GTK, and fixed sliders/percent widgets not
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 93
diff changeset
5914
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5915 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5916 * 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
5917 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5918 * 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
5919 * 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
5920 * 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
5921 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5922 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
5923 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5924 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5925 SLDCDATA sldcData = { 0, 0, 0, 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5926 HWND tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5927
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5928 sldcData.cbSize = sizeof(SLDCDATA);
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
5929 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
5930
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5931 tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5932 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5933 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5934 WS_VISIBLE | SLS_SNAPTOINCREMENT |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5935 (vertical ? SLS_VERTICAL : SLS_HORIZONTAL),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5936 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5937 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5938 HWND_TOP,
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
5939 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5940 &sldcData,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5941 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5942
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5943 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5944 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5945 return 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
5946 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5947
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
5948 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5949 * 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
5950 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5951 * 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
5952 * 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
5953 * 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
5954 */
511
80dbd5a1f403 Removed the increments parameter from dw_scrollbar_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 510
diff changeset
5955 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
5956 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5957 return WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5958 WC_SCROLLBAR,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5959 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5960 WS_VISIBLE | SBS_AUTOTRACK |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5961 (vertical ? SBS_VERT : SBS_HORZ),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5962 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5963 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5964 HWND_TOP,
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
5965 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5966 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5967 NULL);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5968 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5969
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
5970 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
5971 * Create a new percent bar window (widget) to be packed.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5972 * 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
5973 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5974 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
5975 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
5976 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5977 WindowData *blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5978 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5979 WC_SLIDER,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
5980 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5981 WS_VISIBLE | SLS_READONLY
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5982 | SLS_RIBBONSTRIP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5983 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5984 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5985 HWND_TOP,
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
5986 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5987 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5988 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5989 blah->oldproc = WinSubclassWindow(tmp, _percentproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5990 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5991 dw_window_disable(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
5992 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5993 }
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 * Create a new checkbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5997 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
5998 * 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
5999 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6000 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6001 HWND API dw_checkbox_new(char *text, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6002 {
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6003 WindowData *blah = calloc(1, sizeof(WindowData));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6004 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6005 WC_BUTTON,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6006 (PSZ)text,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6007 WS_VISIBLE | BS_AUTOCHECKBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6008 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6009 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6010 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6011 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6012 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6013 NULL);
1392
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6014 blah->bubbletext[0] = '\0';
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6015 blah->oldproc = WinSubclassWindow(tmp, _BtProc);
943266c86aed Refactoring OS/2 and Windows code... eliminating BubbleButton...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1389
diff changeset
6016 WinSetWindowPtr(tmp, QWP_USER, blah);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6017 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6018 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6019 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6020 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6021
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6022 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6023 * Create a new listbox window (widget) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6024 * 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
6025 * id: An ID to be used with dw_window_from_id() or 0L.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6026 * multi: Multiple select TRUE or FALSE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6027 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6028 HWND API dw_listbox_new(ULONG id, int multi)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6029 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6030 WindowData *blah = calloc(sizeof(WindowData), 1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6031 HWND tmp = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6032 WC_LISTBOX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6033 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6034 WS_VISIBLE | LS_NOADJUSTPOS |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6035 (multi ? LS_MULTIPLESEL : 0),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6036 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6037 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6038 HWND_TOP,
1196
452a5b1b2aa5 Fixed a longstanding issue on OS/2 of event handlers being
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1195
diff changeset
6039 id ? id : _GlobalID(),
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6040 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6041 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6042 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6043 WinSetWindowPtr(tmp, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6044 dw_window_set_font(tmp, DefaultFont);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6045 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6046 return tmp;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6047 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6048
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6049 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6050 * Sets the icon used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6051 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6052 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6053 * id: An ID to be used to specify the icon.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6054 */
672
388f2a48aaae Missed one function to typedef. Fixed errors in the test program and switched to using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 671
diff changeset
6055 void API dw_window_set_icon(HWND handle, HICN icon)
388f2a48aaae Missed one function to typedef. Fixed errors in the test program and switched to using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 671
diff changeset
6056 {
388f2a48aaae Missed one function to typedef. Fixed errors in the test program and switched to using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 671
diff changeset
6057 HPOINTER hptr = icon < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,icon) : (HPOINTER)icon;
388f2a48aaae Missed one function to typedef. Fixed errors in the test program and switched to using
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 671
diff changeset
6058 WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6059 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6060
278
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6061 /* 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
6062 * 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
6063 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6064 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
6065 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6066 HFILE BitmapFileHandle = NULLHANDLE; /* handle for the file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6067 ULONG OpenAction = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6068 PBYTE BitmapFileBegin; /* pointer to the first byte of bitmap data */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6069 FILESTATUS BitmapStatus;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6070 ULONG cbRead;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6071 PBITMAPFILEHEADER2 pBitmapFileHeader;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6072 PBITMAPINFOHEADER2 pBitmapInfoHeader;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6073 ULONG ScanLines, ulFlags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6074 HPS hps1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6075 HDC hdc1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6076 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6077
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6078 /* open bitmap file */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6079 DosOpen((PSZ)file, &BitmapFileHandle, &OpenAction, 0L,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6080 FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6081 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6082 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6083 OPEN_FLAGS_NOINHERIT, 0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6084
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6085 if(!BitmapFileHandle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6086 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6087
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6088 /* find out how big the file is */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6089 DosQueryFileInfo(BitmapFileHandle, 1, &BitmapStatus,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6090 sizeof(BitmapStatus));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6091
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6092 /* allocate memory to load the bitmap */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6093 DosAllocMem((PPVOID)&BitmapFileBegin, (ULONG)BitmapStatus.cbFile,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6094 PAG_READ | PAG_WRITE | PAG_COMMIT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6095
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6096 /* read bitmap file into memory buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6097 DosRead(BitmapFileHandle, (PVOID)BitmapFileBegin,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6098 BitmapStatus.cbFile, &cbRead);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6099
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6100 /* access first bytes as bitmap header */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6101 pBitmapFileHeader = (PBITMAPFILEHEADER2)BitmapFileBegin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6102
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6103 /* check if it's a valid bitmap data file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6104 if((pBitmapFileHeader->usType != BFT_BITMAPARRAY) &&
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6105 (pBitmapFileHeader->usType != BFT_BMAP))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6106 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6107 /* free memory of bitmap file buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6108 DosFreeMem(BitmapFileBegin);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6109 /* close the bitmap file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6110 DosClose(BitmapFileHandle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6111 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6112 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6113
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6114 /* check if it's a file with multiple bitmaps */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6115 if(pBitmapFileHeader->usType == BFT_BITMAPARRAY)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6116 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6117 /* we'll just use the first bitmap and ignore the others */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6118 pBitmapFileHeader = &(((PBITMAPARRAYFILEHEADER2)BitmapFileBegin)->bfh2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6119 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6120
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6121 /* set pointer to bitmap information block */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6122 pBitmapInfoHeader = &pBitmapFileHeader->bmp2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6123
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6124 /* find out if it's the new 2.0 format or the old format */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6125 /* and query number of lines */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6126 if(pBitmapInfoHeader->cbFix == sizeof(BITMAPINFOHEADER))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6127 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6128 *height = ScanLines = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6129 *width = (ULONG)((PBITMAPINFOHEADER)pBitmapInfoHeader)->cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6130 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6131 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6132 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6133 *height = ScanLines = pBitmapInfoHeader->cy;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6134 *width = pBitmapInfoHeader->cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6135 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6136
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6137 /* now we need a presentation space, get it from static control */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6138 hps1 = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6139
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6140 hdc1 = GpiQueryDevice(hps1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6141 ulFlags = GpiQueryPS(hps1, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6142
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6143 *hdc = DevOpenDC(dwhab, OD_MEMORY, (PSZ)"*", 0L, NULL, hdc1);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6144 *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6145
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6146 /* create bitmap now using the parameters from the info block */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6147 *hbm = GpiCreateBitmap(*hps, pBitmapInfoHeader, 0L, NULL, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6148
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6149 /* select the new bitmap into presentation space */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6150 GpiSetBitmap(*hps, *hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6151
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6152 /* now copy the bitmap data into the bitmap */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6153 GpiSetBitmapBits(*hps, 0L, ScanLines,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6154 BitmapFileBegin + pBitmapFileHeader->offBits,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6155 (PBITMAPINFO2)pBitmapInfoHeader);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6156
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6157 WinReleasePS(hps1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6158
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6159 /* free memory of bitmap file buffer */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6160 DosFreeMem(BitmapFileBegin);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6161 /* close the bitmap file */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6162 DosClose(BitmapFileHandle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6163 return 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
6164 }
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6165
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6166 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6167 * Sets the bitmap used for a given static window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6168 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6169 * 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
6170 * 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
6171 * (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
6172 * 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
6173 * 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
6174 * 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
6175 */
df0665ba147f Initial code for dw_bitmapbutton_new_from_file and added filename parameter
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 276
diff changeset
6176 void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6177 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6178 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6179 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6180
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6181 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6182 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6183
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6184 /* If id is non-zero use the resource */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6185 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6186 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6187 hps = WinGetPS( handle );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6188 hbm = GpiLoadBitmap( hps, NULLHANDLE, id, 0, 0 );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6189 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6190 else if ( filename )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6191 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6192 HDC hdc;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6193 unsigned long width, height;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6194 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6195
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6196 if(!file)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6197 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6198
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6199 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6200
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6201 /* check if we can read from this file (it exists and read permission) */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6202 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6203 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6204 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6205 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6206 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6207 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6208 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6209
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6210 if(!_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height))
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6211 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6212
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6213 dw_window_set_data(handle, "_dw_hps", (void *)hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6214 dw_window_set_data(handle, "_dw_hdc", (void *)hdc);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6215 dw_window_set_data(handle, "_dw_width", (void *)width);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6216 dw_window_set_data(handle, "_dw_height", (void *)height);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6217 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6218 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6219 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6220
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6221 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6222 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6223 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6224 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6225 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6226 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6227
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6228 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6229 * Sets the bitmap used for a given static window.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6230 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6231 * handle: Handle to the window.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6232 * id: An ID to be used to specify the icon,
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6233 * (pass 0 if you use the filename param)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6234 * filename: a path to a file (Bitmap on OS/2 or
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6235 * Windows and a pixmap on Unix, pass
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6236 * NULL if you use the id param)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6237 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6238 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6239 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6240 HBITMAP hbm;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6241 HPS hps;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6242 HDC hdc;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6243 unsigned long width, height;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6244 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6245 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6246
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6247 /* Destroy any old bitmap data */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6248 _free_bitmap(handle);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6249
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6250 /* If id is non-zero use the resource */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6251 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6252 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6253 hps = WinGetPS( handle );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6254 hbm = GpiLoadBitmap( hps, NULLHANDLE, id, 0, 0 );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6255 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6256 else if ( data )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6257 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6258 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6259 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6260 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6261 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6262 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6263 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6264 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6265 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6266 if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6267 _load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6268 else /* otherwise its assumed to be an ico */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6269 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6270 /* con't use ICO ? */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6271 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6272 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6273 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6274 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6275 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6276 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6277 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6278 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6279 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6280 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6281 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6282
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6283 dw_window_set_data(handle, "_dw_hps", (void *)hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6284 dw_window_set_data(handle, "_dw_hdc", (void *)hdc);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6285 dw_window_set_data(handle, "_dw_width", (void *)width);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6286 dw_window_set_data(handle, "_dw_height", (void *)height);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6287 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6288 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6289 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6290
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6291 WinSetWindowBits(handle,QWL_STYLE,SS_BITMAP,SS_BITMAP | 0x7f);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6292 WinSendMsg( handle, SM_SETHANDLE, MPFROMP(hbm), NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6293 if ( id )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6294 WinReleasePS(hps);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6295 dw_window_set_data(handle, "_dw_bitmap", (void *)hbm);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6296 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6297
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6298 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6299 * Sets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6300 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6301 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6302 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6303 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6304 void API dw_window_set_text(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6305 {
1047
5dbb931bac5a Changed the data names from _dw_entry/_dw_group to _dw_buddy on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1044
diff changeset
6306 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy");
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6307 WinSetWindowText(entryfield ? entryfield : handle, (PSZ)text);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6308 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6309
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6310 /*
1389
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6311 * Sets the text used for a given window's floating bubble help.
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6312 * Parameters:
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6313 * handle: Handle to the window (widget).
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6314 * bubbletext: The text in the floating bubble tooltip.
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6315 */
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6316 void API dw_window_set_tooltip(HWND handle, char *bubbletext)
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6317 {
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6318 /* TODO: Fill this in with generic bubble help code...
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6319 * like we do for the bitmap buttons.
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6320 */
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6321 }
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6322
0512fbb08abf Added dw_window_set_tooltip() for adding bubble help to most controls.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1386
diff changeset
6323 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6324 * Gets the text used for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6325 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6326 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6327 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6328 * text: The text associsated with a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6329 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6330 char * API dw_window_get_text(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6331 {
1047
5dbb931bac5a Changed the data names from _dw_entry/_dw_group to _dw_buddy on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1044
diff changeset
6332 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy");
1034
af2c93f78ae9 Attempt at making dw_window_set/get_text() work on spinbuttons on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1029
diff changeset
6333 int len = WinQueryWindowTextLength(entryfield ? entryfield : handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6334 char *tempbuf = calloc(1, len + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6335
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6336 WinQueryWindowText(entryfield ? entryfield : handle, len + 1, (PSZ)tempbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6337
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6338 return tempbuf;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6339 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6340
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6341 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6342 * Disables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6343 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6344 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6345 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6346 void API dw_window_disable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6347 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6348 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6349
1304
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6350 if(handle < 65536)
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6351 {
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6352 char buffer[30];
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6353 HMENUI mymenu;
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6354
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6355 sprintf(buffer, "_dw_id%ld", handle);
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6356 mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer);
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6357
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6358 if(mymenu && WinIsWindow(dwhab, mymenu))
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6359 dw_menu_item_set_state(mymenu, handle, DW_MIS_DISABLED);
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6360 return;
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6361 }
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6362
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6363 if(dw_window_get_data(handle, "_dw_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6364 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6365
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6366 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6367 dw_window_set_data(handle, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6368
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6369 if(tmpbuf[0] == '#')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6370 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6371 int val = atoi(&tmpbuf[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6372 HWND hwnd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6373
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6374 switch(val)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6375 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6376 case 2:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6377 case 6:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6378 case 10:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6379 case 32:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6380 case 7:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6381 hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6382 _dw_window_set_color(hwnd ? hwnd : handle, DW_CLR_BLACK, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6383 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
6384 if(val == 2)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6385 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6386 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6387 dw_window_set_data(hwnd, "_dw_disabled", (void *)1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6388 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6389 case 3:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6390 if(dw_window_get_data(handle, "_dw_bitmapbutton") && !dw_window_get_data(handle, "_dw_hpixmap"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6391 WinEnableWindow(handle, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6392 else if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6393 WinInvalidateRect(handle, NULL, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6394 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6395 _dw_window_set_color(handle, DW_CLR_DARKGRAY, DW_CLR_PALEGRAY);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6396 dw_signal_connect(handle, DW_SIGNAL_KEY_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6397 dw_signal_connect(handle, DW_SIGNAL_BUTTON_PRESS, DW_SIGNAL_FUNC(_null_key), (void *)100);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6398 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6399 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6400 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6401 WinEnableWindow(handle, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6402 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6403
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6404 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6405 * Enables given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6406 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6407 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6408 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6409 void API dw_window_enable(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6410 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6411 ULONG fore = (ULONG)dw_window_get_data(handle, "_dw_fore");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6412 ULONG back = (ULONG)dw_window_get_data(handle, "_dw_back");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6413 HWND hwnd = _find_entryfield(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6414
1304
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6415 if(handle < 65536)
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6416 {
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6417 char buffer[30];
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6418 HMENUI mymenu;
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6419
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6420 sprintf(buffer, "_dw_id%ld", handle);
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6421 mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer);
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6422
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6423 if(mymenu && WinIsWindow(dwhab, mymenu))
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6424 dw_menu_item_set_state(mymenu, handle, DW_MIS_ENABLED);
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6425 return;
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6426 }
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
6427
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6428 dw_window_set_data(handle, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6429 if(hwnd)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6430 dw_window_set_data(hwnd, "_dw_disabled", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6431 if(fore && back)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6432 _dw_window_set_color(hwnd ? hwnd : handle, fore-1, back-1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6433 dw_signal_disconnect_by_data(handle, (void *)100);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6434 WinEnableWindow(handle, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6435 if(dw_window_get_data(handle, "_dw_bitmapbutton") && dw_window_get_data(handle, "_dw_hpixmap_disabled"))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6436 WinInvalidateRect(handle, NULL, FALSE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6437 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6438
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6439 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6440 * Gets the child window handle with specified ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6441 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6442 * handle: Handle to the parent window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6443 * id: Integer ID of the child.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6444 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6445 HWND API dw_window_from_id(HWND handle, int id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6446 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6447 HENUM henum;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6448 HWND child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6449 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6450
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6451 henum = WinBeginEnumWindows(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6452 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6453 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6454 int windowid = WinQueryWindowUShort(child, QWS_ID);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6455 HWND found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6456
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6457 WinQueryClassName(child, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6458
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6459 /* If the child is a box (frame) then recurse into it */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6460 if(strncmp(tmpbuf, "#1", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6461 if((found = dw_window_from_id(child, id)) != NULLHANDLE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6462 return found;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6463
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6464 if(windowid && windowid == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6465 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6466 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6467 return child;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6468 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6469 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6470 WinEndEnumWindows(henum);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6471 return NULLHANDLE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6472 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6473
1085
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6474 /* Internal box packing function called by the other 3 functions */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6475 void _dw_box_pack(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad, char *funcname)
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6476 {
1077
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6477 Box *thisbox;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6478
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6479 /*
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6480 * If you try and pack an item into itself VERY bad things can happen; like at least an
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6481 * infinite loop on GTK! Lets be safe!
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6482 */
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6483 if(box == item)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6484 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6485 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!");
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6486 return;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6487 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6488
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6489 if(WinWindowFromID(box, FID_CLIENT))
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6490 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6491 HWND intbox = (HWND)dw_window_get_data(box, "_dw_box");
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6492 if(intbox)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6493 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6494 box = intbox;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6495 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6496 else
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6497 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6498 box = WinWindowFromID(box, FID_CLIENT);
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6499 hsize = vsize = TRUE;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6500 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6501 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6502
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6503 thisbox = WinQueryWindowPtr(box, QWP_USER);
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6504
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6505 if(thisbox)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6506 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6507 int z, x = 0;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6508 Item *tmpitem, *thisitem = thisbox->items;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6509 char tmpbuf[100];
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6510 HWND frame = (HWND)dw_window_get_data(item, "_dw_combo_box");
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6511
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6512 /* Do some sanity bounds checking */
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6513 if(index < 0)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6514 index = 0;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6515 if(index > thisbox->count)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6516 index = thisbox->count;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6517
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6518 tmpitem = malloc(sizeof(Item)*(thisbox->count+1));
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6519
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6520 for(z=0;z<thisbox->count;z++)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6521 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6522 if(z == index)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6523 x++;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6524 tmpitem[x] = thisitem[z];
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6525 x++;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6526 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6527
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6528
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6529 WinQueryClassName(item, 99, (PCH)tmpbuf);
1077
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6530
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6531 if(vsize && !height)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6532 height = 1;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6533 if(hsize && !width)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6534 width = 1;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6535
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6536 if(strncmp(tmpbuf, "#1", 3)==0)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6537 tmpitem[index].type = TYPEBOX;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6538 else
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6539 {
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6540 if ( width == 0 && hsize == FALSE )
1078
6eadfe0007b4 Fixed erroneously named variables for the message boxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1077
diff changeset
6541 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
1077
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6542 if ( height == 0 && vsize == FALSE )
1078
6eadfe0007b4 Fixed erroneously named variables for the message boxes on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1077
diff changeset
6543 dw_messagebox(funcname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
1077
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6544
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6545 tmpitem[index].type = TYPEITEM;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6546 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6547
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6548 tmpitem[index].hwnd = item;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6549 tmpitem[index].origwidth = tmpitem[index].width = width;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6550 tmpitem[index].origheight = tmpitem[index].height = height;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6551 tmpitem[index].pad = pad;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6552 if(hsize)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6553 tmpitem[index].hsize = SIZEEXPAND;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6554 else
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6555 tmpitem[index].hsize = SIZESTATIC;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6556
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6557 if(vsize)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6558 tmpitem[index].vsize = SIZEEXPAND;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6559 else
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6560 tmpitem[index].vsize = SIZESTATIC;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6561
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6562 thisbox->items = tmpitem;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6563
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6564 if(thisbox->count)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6565 free(thisitem);
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6566
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6567 thisbox->count++;
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6568
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6569 WinQueryClassName(item, 99, (PCH)tmpbuf);
1077
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6570 /* Don't set the ownership if it's an entryfield or spinbutton */
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6571 if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0)
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6572 WinSetOwner(item, box);
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6573 WinSetParent(frame ? frame : item, box, FALSE);
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6574 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6575 }
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6576
34f1d6f5f1c3 Added function dw_box_pack_at_index() on Windows, Mac and OS/2. And an example usage in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1075
diff changeset
6577 /*
1085
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6578 * Pack windows (widgets) into a box at an arbitrary location.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6579 * Parameters:
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6580 * box: Window handle of the box to be packed into.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6581 * item: Window handle of the item to be back.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6582 * index: 0 based index of packed items.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6583 * width: Width in pixels of the item or -1 to be self determined.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6584 * height: Height in pixels of the item or -1 to be self determined.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6585 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6586 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6587 * pad: Number of pixels of padding around the item.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6588 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6589 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad)
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6590 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6591 _dw_box_pack(box, item, index, width, height, hsize, vsize, pad, "dw_box_pack_at_index()");
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6592 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6593
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6594 /*
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6595 * Pack windows (widgets) into a box from the start (or top).
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6596 * Parameters:
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6597 * box: Window handle of the box to be packed into.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6598 * item: Window handle of the item to be back.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6599 * width: Width in pixels of the item or -1 to be self determined.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6600 * height: Height in pixels of the item or -1 to be self determined.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6601 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6602 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6603 * pad: Number of pixels of padding around the item.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6604 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6605 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6606 {
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6607 /* 65536 is the table limit on GTK...
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6608 * seems like a high enough value we will never hit it here either.
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6609 */
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6610 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()");
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6611 }
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6612
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6613 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6614 * Pack windows (widgets) into a box from the end (or bottom).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6615 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6616 * box: Window handle of the box to be packed into.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6617 * item: Window handle of the item to be back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6618 * width: Width in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6619 * height: Height in pixels of the item or -1 to be self determined.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6620 * hsize: TRUE if the window (widget) should expand horizontally to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6621 * vsize: TRUE if the window (widget) should expand vertically to fill space given.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6622 * pad: Number of pixels of padding around the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6623 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6624 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
6625 {
1085
5a951cfd67ad Merge all 3 box packing functions into one internal function on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1078
diff changeset
6626 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()");
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6627 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6628
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6629 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6630 * Sets the size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6631 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6632 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6633 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6634 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6635 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6636 void API dw_window_set_size(HWND handle, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6637 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6638 WinSetWindowPos(handle, NULLHANDLE, 0, 0, width, height, SWP_SHOW | SWP_SIZE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6639 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6640
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6641 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6642 * Returns the width of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6643 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6644 int API dw_screen_width(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6645 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6646 return WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6647 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6648
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6649 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6650 * Returns the height of the screen.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6651 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6652 int API dw_screen_height(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6653 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6654 return WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6655 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6656
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6657 /* 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
6658 unsigned long API dw_color_depth_get(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6659 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6660 HDC hdc = WinOpenWindowDC(HWND_DESKTOP);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6661 long colors;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6662
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6663 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &colors);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6664 DevCloseDC(hdc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6665 return colors;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6666 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6667
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6668
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6669 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6670 * Sets the position of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6671 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6672 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6673 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6674 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6675 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6676 void API dw_window_set_pos(HWND handle, LONG x, LONG y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6677 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6678 int myy = _get_frame_height(handle) - (y + _get_height(handle));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6679
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6680 WinSetWindowPos(handle, NULLHANDLE, x, myy, 0, 0, SWP_MOVE);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6681 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6682
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6683 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6684 * Sets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6685 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6686 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6687 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6688 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6689 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6690 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6691 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6692 void API dw_window_set_pos_size(HWND handle, LONG x, LONG y, ULONG width, ULONG height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6693 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6694 int myy = _get_frame_height(handle) - (y + height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6695
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6696 WinSetWindowPos(handle, NULLHANDLE, x, myy, width, height, SWP_MOVE | SWP_SIZE | SWP_SHOW);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6697 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6698
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6699 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6700 * Gets the position and size of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6701 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6702 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6703 * x: X location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6704 * y: Y location from the bottom left.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6705 * width: Width of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6706 * height: Height of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6707 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
6708 void API dw_window_get_pos_size(HWND handle, LONG *x, LONG *y, ULONG *width, ULONG *height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6709 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6710 SWP swp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6711 WinQueryWindowPos(handle, &swp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6712 if(x)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6713 *x = swp.x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6714 if(y)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6715 *y = _get_frame_height(handle) - (swp.y + swp.cy);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6716 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6717 *width = swp.cx;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6718 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6719 *height = swp.cy;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6720 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6721
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6722 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6723 * Sets the style of a given window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6724 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6725 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6726 * width: New width in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6727 * height: New height in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6728 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6729 void API dw_window_set_style(HWND handle, ULONG style, ULONG mask)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6730 {
1314
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6731 if(handle < 65536)
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6732 {
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6733 char buffer[30];
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6734 HMENUI mymenu;
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6735
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6736 sprintf(buffer, "_dw_id%ld", handle);
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6737 mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer);
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6738
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6739 if(mymenu && WinIsWindow(dwhab, mymenu))
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6740 dw_menu_item_set_state(mymenu, handle, style & mask);
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6741 }
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6742 else
c969db49606e Initial commit allowing dw_window_set_style() to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1311
diff changeset
6743 WinSetWindowBits(handle, QWL_STYLE, style, mask);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6744 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6745
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6746 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6747 * Adds a new page to specified notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6748 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6749 * handle: Window (widget) handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6750 * flags: Any additional page creation flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6751 * front: If TRUE page is added at the beginning.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6752 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6753 unsigned long API dw_notebook_page_new(HWND handle, ULONG flags, int front)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6754 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6755 return (ULONG)WinSendMsg(handle, BKM_INSERTPAGE, 0L,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6756 MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR | flags), front ? BKA_FIRST : BKA_LAST));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6757 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6758
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6759 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6760 * Remove a page from a notebook.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6761 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6762 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6763 * pageid: ID of the page to be destroyed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6764 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6765 void API dw_notebook_page_destroy(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6766 {
1331
4c12170f003f Make dw_notebook_page_destroy() on OS/2 and Windows destroy the contents of the page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1325
diff changeset
6767 HWND pagehwnd = (HWND)WinSendMsg(handle, BKM_QUERYPAGEWINDOWHWND,
4c12170f003f Make dw_notebook_page_destroy() on OS/2 and Windows destroy the contents of the page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1325
diff changeset
6768 MPFROMLONG(pageid), 0L);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6769 WinSendMsg(handle, BKM_DELETEPAGE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6770 MPFROMLONG(pageid), (MPARAM)BKA_SINGLE);
1331
4c12170f003f Make dw_notebook_page_destroy() on OS/2 and Windows destroy the contents of the page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1325
diff changeset
6771 if(pagehwnd)
4c12170f003f Make dw_notebook_page_destroy() on OS/2 and Windows destroy the contents of the page.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1325
diff changeset
6772 dw_window_destroy(pagehwnd);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6773 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6774
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6775 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6776 * Queries the currently visible page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6777 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6778 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6779 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6780 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
6781 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6782 return (unsigned long)WinSendMsg(handle, BKM_QUERYPAGEID,0L, MPFROM2SHORT(BKA_TOP, BKA_MAJOR));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6783 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6784
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6785 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6786 * Sets the currently visibale page ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6787 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6788 * handle: Handle to the notebook widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6789 * pageid: ID of the page to be made visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6790 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6791 void API dw_notebook_page_set(HWND handle, unsigned int pageid)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6792 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6793 WinSendMsg(handle, BKM_TURNTOPAGE, MPFROMLONG(pageid), 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6794 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6795
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6796 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6797 * Sets the text on the specified notebook tab.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6798 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6799 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6800 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6801 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6802 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6803 void API dw_notebook_page_set_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6804 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6805 WinSendMsg(handle, BKM_SETTABTEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6806 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6807 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6808
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6809 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6810 * Sets the text on the specified notebook tab status area.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6811 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6812 * handle: Notebook handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6813 * pageid: Page ID of the tab to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6814 * text: Pointer to the text to set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6815 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6816 void API dw_notebook_page_set_status_text(HWND handle, ULONG pageid, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6817 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6818 WinSendMsg(handle, BKM_SETSTATUSLINETEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6819 MPFROMLONG(pageid), MPFROMP(text));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6820 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6821
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6822 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6823 * Packs the specified box into the notebook page.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6824 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6825 * handle: Handle to the notebook to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6826 * pageid: Page ID in the notebook which is being packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6827 * page: Box handle to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6828 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6829 void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6830 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6831 HWND tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6832
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6833 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6834 WinSubclassWindow(tmpbox, _wndproc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6835 WinSendMsg(handle, BKM_SETPAGEWINDOWHWND,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6836 MPFROMLONG(pageid), MPFROMHWND(tmpbox));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6837 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6838
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6839 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6840 * Appends the specified text to the listbox's (or combobox) entry list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6841 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6842 * handle: Handle to the listbox to be appended to.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6843 * text: Text to append into listbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6844 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6845 void API dw_listbox_append(HWND handle, char *text)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6846 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6847 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6848 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6849 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6850 MPFROMP(text));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6851 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6852
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6853 /*
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6854 * Inserts the specified text into the listbox's (or combobox) entry list.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6855 * Parameters:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6856 * handle: Handle to the listbox to be inserted into.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6857 * text: Text to insert into listbox.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6858 * pos: 0-based position to insert text
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6859 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6860 void API dw_listbox_insert(HWND handle, char *text, int pos)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6861 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6862 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6863 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6864 MPFROMSHORT(pos),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6865 MPFROMP(text));
3
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 /*
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6869 * 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
6870 * Parameters:
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6871 * 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
6872 * text: Text strings to append into listbox.
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6873 * count: Number of text strings to append
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6874 */
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6875 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
6876 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6877 int i;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6878 for(i=0;i<count;i++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6879 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6880 LM_INSERTITEM,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6881 MPFROMSHORT(LIT_END),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6882 MPFROMP(text[i]));
571
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6883 }
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6884
828e6a66c5c5 Add dw_listbox_list_append()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 568
diff changeset
6885 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6886 * Clears the listbox's (or combobox) list of all entries.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6887 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6888 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6889 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6890 void API dw_listbox_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6891 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6892 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6893 LM_DELETEALL, 0L, 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6894 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6895
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6896 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6897 * Returns the listbox's item count.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6898 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6899 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6900 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6901 int API dw_listbox_count(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6902 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6903 return (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6904 LM_QUERYITEMCOUNT,0L, 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6905 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6906
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6907 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6908 * Sets the topmost item in the viewport.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6909 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6910 * handle: Handle to the listbox to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6911 * top: Index to the top item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6912 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6913 void API dw_listbox_set_top(HWND handle, int top)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6914 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6915 WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6916 LM_SETTOPINDEX,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6917 MPFROMSHORT(top),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6918 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6919 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6920
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6921 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6922 * Copies the given index item's text into buffer.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6923 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6924 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6925 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6926 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6927 * length: Length of the buffer (including NULL).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6928 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
6929 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
6930 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6931 WinSendMsg(handle, LM_QUERYITEMTEXT, MPFROM2SHORT(index, length), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6932 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6933
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6934 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6935 * Sets the text of a given listbox entry.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6936 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6937 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6938 * index: Index into the list to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6939 * buffer: Buffer where text will be copied.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6940 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6941 void API dw_listbox_set_text(HWND handle, unsigned int index, char *buffer)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6942 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6943 WinSendMsg(handle, LM_SETITEMTEXT, MPFROMSHORT(index), (MPARAM)buffer);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6944 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6945
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6946 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6947 * Returns the index to the item in the list currently selected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6948 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6949 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6950 */
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
6951 int API dw_listbox_selected(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6952 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6953 return (unsigned int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6954 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6955 MPFROMSHORT(LIT_CURSOR),
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6956 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6957 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6958
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6959 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6960 * Returns the index to the current selected item or -1 when done.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6961 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6962 * handle: Handle to the listbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6963 * where: Either the previous return or -1 to restart.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6964 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6965 int API dw_listbox_selected_multi(HWND handle, int where)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6966 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6967 int place = where;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6968
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6969 if(where == -1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6970 place = LIT_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6971
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6972 place = (int)WinSendMsg(handle,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6973 LM_QUERYSELECTION,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6974 MPFROMSHORT(place),0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6975 if(place == LIT_NONE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6976 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6977 return place;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6978 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6979
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6980 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6981 * Sets the selection state of a given index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6982 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6983 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6984 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6985 * state: TRUE if selected FALSE if unselected.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6986 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
6987 void API dw_listbox_select(HWND handle, int index, int state)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6988 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6989 char tmpbuf[100];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6990
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6991 WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6992
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
6993 WinQueryClassName(handle, 99, (PCH)tmpbuf);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6994
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6995 /* If we are setting a combobox call the event handler manually */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6996 if(strncmp(tmpbuf, "#6", 3)==0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
6997 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, LN_SELECT), (MPARAM)handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6998 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
6999
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7000 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7001 * Deletes the item with given index from the list.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7002 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7003 * handle: Handle to the listbox to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7004 * index: Item index.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7005 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7006 void API dw_listbox_delete(HWND handle, int index)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7007 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7008 WinSendMsg(handle, LM_DELETEITEM, MPFROMSHORT(index), 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7009 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7010
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7011 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7012 * Adds text to an MLE box and returns the current point.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7013 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7014 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7015 * buffer: Text buffer to be imported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7016 * startpoint: Point to start entering text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7017 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7018 unsigned int API dw_mle_import(HWND handle, char *buffer, int startpoint)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7019 {
990
3d898b78c2ad Fix return value of dw_mle_import() after importing empty string on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 986
diff changeset
7020 long point = startpoint < 0 ? 0 : startpoint;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7021 PBYTE mlebuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7022
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7023 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7024 if(!DosAllocMem((PPVOID) &mlebuf, 65536, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7025 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7026 int amount, len = strlen(buffer), written = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7027
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7028 while(written < len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7029 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7030 int z, x = 0;
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7031
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7032 if((len - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7033 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7034 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7035 amount = len - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7036
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7037 /* Remove Carriage Returns \r */
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7038 for(z=0;z<amount;z++)
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7039 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7040 if(buffer[z] != '\r')
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7041 {
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7042 mlebuf[x] = buffer[z];
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7043 x++;
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7044 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7045 }
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7046
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7047 if(point < 0)
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7048 point = 0;
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7049 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(x));
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7050 WinSendMsg(handle, MLM_IMPORT, MPFROMP(&point), MPFROMLONG(x));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7051
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7052 written += amount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7053 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7054 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7055 }
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7056 return point;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7057 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7058
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7059 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7060 * Grabs text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7061 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7062 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7063 * buffer: Text buffer to be exported.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7064 * startpoint: Point to start grabbing text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7065 * length: Amount of text to be grabbed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7066 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7067 void API dw_mle_export(HWND handle, char *buffer, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7068 {
1000
99907f19a703 Minor fixed and code cleanups on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 996
diff changeset
7069 PBYTE mlebuf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7070
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7071 /* Work around 64K limit */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7072 if(!DosAllocMem((PPVOID) &mlebuf, 65535, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7073 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7074 int amount, copied, written = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7075
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7076 while(written < length)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7077 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7078 if((length - written) > 65535)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7079 amount = 65535;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7080 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7081 amount = length - written;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7082
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7083 WinSendMsg(handle, MLM_SETIMPORTEXPORT, MPFROMP(mlebuf), MPFROMLONG(amount));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7084 copied = (int)WinSendMsg(handle, MLM_EXPORT, MPFROMP(&startpoint), MPFROMLONG(&amount));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7085
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7086 if(copied)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7087 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7088 memcpy(&buffer[written], mlebuf, copied);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7089
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7090 written += copied;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7091 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7092 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7093 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7094 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7095 DosFreeMem(mlebuf);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7096 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7097 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7098
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7099 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7100 * Obtains information about an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7101 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7102 * handle: Handle to the MLE to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7103 * bytes: A pointer to a variable to return the total bytes.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7104 * lines: A pointer to a variable to return the number of lines.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7105 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7106 void API dw_mle_get_size(HWND handle, unsigned long *bytes, unsigned long *lines)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7107 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7108 if(bytes)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7109 *bytes = (unsigned long)WinSendMsg(handle, MLM_QUERYTEXTLENGTH, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7110 if(lines)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7111 *lines = (unsigned long)WinSendMsg(handle, MLM_QUERYLINECOUNT, 0, 0);
3
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 * Deletes text from an MLE box.
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 MLE to be deleted from.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7118 * startpoint: Point to start deleting text.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7119 * length: Amount of text to be deleted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7120 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7121 void API dw_mle_delete(HWND handle, int startpoint, int length)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7122 {
995
65ccdda2d743 Fixes to MLE handling to make it work like the other platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 990
diff changeset
7123 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(startpoint), MPFROMLONG(length));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7124 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7125
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7126 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7127 * Clears all text from an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7128 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7129 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7130 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7131 void API dw_mle_clear(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7132 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7133 unsigned long bytes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7134
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7135 dw_mle_get_size(handle, &bytes, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7136
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7137 WinSendMsg(handle, MLM_DELETE, MPFROMLONG(0), MPFROMLONG(bytes));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7138 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7139
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7140 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7141 * Sets the visible line of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7142 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7143 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7144 * line: Line to be visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7145 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7146 void API dw_mle_set_visible(HWND handle, int line)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7147 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7148 int tmppnt = (int)WinSendMsg(handle, MLM_CHARFROMLINE, MPFROMLONG(line), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7149 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(tmppnt), MPFROMLONG(tmppnt));
3
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 /*
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7153 * Sets the editablity of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7154 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7155 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7156 * 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
7157 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7158 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
7159 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7160 WinSendMsg(handle, MLM_SETREADONLY, MPFROMLONG(state ? FALSE : TRUE), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7161 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7162
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7163 /*
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7164 * Sets the word wrap state of an MLE box.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7165 * Parameters:
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7166 * handle: Handle to the MLE.
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7167 * 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
7168 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7169 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
7170 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7171 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0);
7
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7172 }
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7173
005fa766e8c2 Updates to latest build.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 3
diff changeset
7174 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7175 * Sets the current cursor position of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7176 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7177 * handle: Handle to the MLE to be positioned.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7178 * point: Point to position cursor.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7179 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7180 void API dw_mle_set_cursor(HWND handle, int point)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7181 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7182 WinSendMsg(handle, MLM_SETSEL, MPFROMLONG(point), MPFROMLONG(point));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7183 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7184
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7185 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7186 * Finds text in an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7187 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7188 * handle: Handle to the MLE to be cleared.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7189 * text: Text to search for.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7190 * point: Start point of search.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7191 * flags: Search specific flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7192 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7193 int API dw_mle_search(HWND handle, char *text, int point, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7194 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7195 MLE_SEARCHDATA msd;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7196
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7197 /* This code breaks with structure packing set to 1 (/Sp1 in VAC)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7198 * if this is needed we need to add a pragma here.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7199 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7200 msd.cb = sizeof(msd);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7201 msd.pchFind = text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7202 msd.pchReplace = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7203 msd.cchFind = strlen(text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7204 msd.cchReplace = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7205 msd.iptStart = point;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7206 msd.iptStop = -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7207
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7208 if(WinSendMsg(handle, MLM_SEARCH, MPFROMLONG(MLFSEARCH_SELECTMATCH | flags), (MPARAM)&msd))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7209 return (int)WinSendMsg(handle, MLM_QUERYSEL,(MPARAM)MLFQS_MAXSEL, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7210 return 0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7211 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7212
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7213 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7214 * Stops redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7215 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7216 * handle: Handle to the MLE to freeze.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7217 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7218 void API dw_mle_freeze(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7219 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7220 WinSendMsg(handle, MLM_DISABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7221 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7222
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7223 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7224 * Resumes redrawing of an MLE box.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7225 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7226 * handle: Handle to the MLE to thaw.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7227 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7228 void API dw_mle_thaw(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7229 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7230 WinSendMsg(handle, MLM_ENABLEREFRESH, 0, 0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7231 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7232
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7233 /* Internal version that can be called from _percentthread */
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7234 void _dw_percent_set_pos(HWND handle, unsigned int position)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7235 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7236 int range = _dw_percent_get_range(handle);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7237
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7238 if(range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7239 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7240 int mypos = (((float)position)/100)*range;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7241
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7242 if(mypos >= range)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7243 mypos = range - 1;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7244
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7245 _dw_int_set(handle, mypos);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7246 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_RANGEVALUE), (MPARAM)mypos);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7247 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7248 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7249
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7250 /* Move the percentage bar backwards to simulate indeterminate */
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7251 void _percentthread(void *data)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7252 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7253 HWND percent = (HWND)data;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7254
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7255 if(percent)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7256 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7257 HAB thishab = WinInitialize(0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7258 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7259
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7260 int pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7261
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7262 do
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7263 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7264 pos--;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7265 if(pos < 1)
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7266 pos = 100;
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7267 _dw_percent_set_pos(percent, pos);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7268 DosSleep(100);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7269 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7270 while(dw_window_get_data(percent, "_dw_ind"));
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7271
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7272 WinDestroyMsgQueue(thishmq);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7273 WinTerminate(thishab);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7274 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7275 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7276
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7277 /*
33
72675de7d229 Renamed slider class to percent class. Implemented my own percent widget
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 31
diff changeset
7278 * Sets the percent bar position.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7279 * 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
7280 * 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
7281 * position: Position of the percent bar withing the range.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7282 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7283 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
7284 {
1190
76262040ed5f Added DW_PERCENT_INDETERMINATE which can be passed to dw_percent_set_pos() to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1183
diff changeset
7285 /* OS/2 doesn't really support indeterminate... */
76262040ed5f Added DW_PERCENT_INDETERMINATE which can be passed to dw_percent_set_pos() to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1183
diff changeset
7286 if(position == DW_PERCENT_INDETERMINATE)
76262040ed5f Added DW_PERCENT_INDETERMINATE which can be passed to dw_percent_set_pos() to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1183
diff changeset
7287 {
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7288 if(!dw_window_get_data(handle, "_dw_ind"))
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7289 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7290 /* So we fake it with a thread */
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7291 dw_window_set_data(handle, "_dw_ind", (void *)1);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7292 _beginthread(_percentthread, NULL, 100, (void *)handle);
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7293 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7294 }
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7295 else
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7296 {
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7297 /* Make sure we are no longer indeterminate */
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7298 dw_window_set_data(handle, "_dw_ind", NULL);
1190
76262040ed5f Added DW_PERCENT_INDETERMINATE which can be passed to dw_percent_set_pos() to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1183
diff changeset
7299 /* Otherwise set the position as usual */
1198
1ef76e93db82 Added a simulated indeterminate state on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1197
diff changeset
7300 _dw_percent_set_pos(handle, position);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7301 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7302 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7303
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7304 /*
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7305 * 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
7306 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7307 * 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
7308 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7309 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
7310 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7311 return (unsigned int)WinSendMsg(handle, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 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
7312 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7313
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7314 /*
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7315 * 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
7316 * Parameters:
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7317 * 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
7318 * 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
7319 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7320 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
7321 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7322 dw_window_set_data(handle, "_dw_slider_value", (void *)position);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7323 WinSendMsg(handle, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), (MPARAM)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
7324 }
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7325
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
7326 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7327 * 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
7328 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7329 * 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
7330 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7331 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
7332 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7333 return (unsigned int)WinSendMsg(handle, SBM_QUERYPOS, 0, 0);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7334 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7335
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7336 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7337 * 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
7338 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7339 * 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
7340 * 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
7341 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7342 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
7343 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7344 dw_window_set_data(handle, "_dw_scrollbar_value", (void *)position);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7345 WinSendMsg(handle, SBM_SETPOS, (MPARAM)position, 0);
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7346 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7347
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7348 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7349 * 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
7350 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7351 * 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
7352 * 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
7353 * 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
7354 */
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
7355 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
7356 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7357 unsigned int pos = (unsigned int)dw_window_get_data(handle, "_dw_scrollbar_value");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7358 WinSendMsg(handle, SBM_SETSCROLLBAR, (MPARAM)pos, MPFROM2SHORT(0, (unsigned short)range - visible));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7359 WinSendMsg(handle, SBM_SETTHUMBSIZE, MPFROM2SHORT((unsigned short)visible, range), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7360 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
7361 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7362
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
7363 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7364 * Sets the spinbutton value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7365 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7366 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7367 * position: Current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7368 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7369 void API dw_spinbutton_set_pos(HWND handle, long position)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7370 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7371 WinSendMsg(handle, SPBM_SETCURRENTVALUE, MPFROMLONG((long)position), 0L);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7372 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7373
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7374 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7375 * Sets the spinbutton limits.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7376 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7377 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7378 * upper: Upper limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7379 * lower: Lower limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7380 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7381 void API dw_spinbutton_set_limits(HWND handle, long upper, long lower)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7382 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7383 WinSendMsg(handle, SPBM_SETLIMITS, MPFROMLONG(upper), MPFROMLONG(lower));
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7384 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7385
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7386 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7387 * Sets the entryfield character limit.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7388 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7389 * handle: Handle to the spinbutton to be set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7390 * limit: Number of characters the entryfield will take.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7391 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7392 void API dw_entryfield_set_limit(HWND handle, ULONG limit)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7393 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7394 WinSendMsg(handle, EM_SETTEXTLIMIT, (MPARAM)limit, (MPARAM)0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7395 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7396
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7397
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7398 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7399 * Returns the current value of the spinbutton.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7400 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7401 * handle: Handle to the spinbutton to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7402 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7403 long API dw_spinbutton_get_pos(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7404 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7405 long tmpval = 0L;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7406
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7407 WinSendMsg(handle, SPBM_QUERYVALUE, (MPARAM)&tmpval,0L);
1024
814e4767277f Set initial range of spin buttons to -65536 to 65536 on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1020
diff changeset
7408 return tmpval;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7409 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7410
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7411 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7412 * Returns the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7413 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7414 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7415 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7416 int API dw_checkbox_get(HWND handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7417 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7418 return (int)WinSendMsg(handle,BM_QUERYCHECK,0,0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7419 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7420
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7421 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7422 * Sets the state of the checkbox.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7423 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7424 * handle: Handle to the checkbox to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7425 * value: TRUE for checked, FALSE for unchecked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7426 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7427 void API dw_checkbox_set(HWND handle, int value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7428 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7429 WinSendMsg(handle,BM_SETCHECK,MPFROMSHORT(value),0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7430 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7431
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7432 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7433 * 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
7434 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7435 * 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
7436 * 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
7437 * 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
7438 * 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
7439 * 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
7440 * 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
7441 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7442 HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, HICN 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
7443 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7444 ULONG cbExtra;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7445 PCNRITEM pci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7446 RECORDINSERT ri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7447
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7448 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7449 item = (HTREEITEM)CMA_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7450
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7451 /* Calculate extra bytes needed for each record besides that needed for the
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7452 * MINIRECORDCORE structure
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7453 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7454
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7455 cbExtra = sizeof(CNRITEM) - sizeof(MINIRECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7456
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7457 /* Allocate memory for the parent record */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7458
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7459 if((pci = (PCNRITEM)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(cbExtra), MPFROMSHORT(1), 0)) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7460 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7461
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7462 /* Fill in the parent record data */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7463
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7464 pci->rc.cb = sizeof(MINIRECORDCORE);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7465 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7466 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7467
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7468 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7469 pci->user = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7470 pci->parent = parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7471
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7472 memset(&ri, 0, sizeof(RECORDINSERT));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7473
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7474 ri.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7475 ri.pRecordOrder = (PRECORDCORE)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7476 ri.zOrder = (USHORT)CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7477 ri.cRecordsInsert = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7478 ri.fInvalidateRecord = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7480 /* We are about to insert the child records. Set the parent record to be
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7481 * the one we just inserted.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7482 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7483 ri.pRecordParent = (PRECORDCORE)parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7484
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7485 /* Insert the record */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7486 WinSendMsg(handle, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7487
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7488 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
7489 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7490
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7491 /*
60
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7492 * 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
7493 * Parameters:
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7494 * 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
7495 * title: The text title of the entry.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7496 * icon: Handle to coresponding icon.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7497 * parent: Parent handle or 0 if root.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7498 * itemdata: Item specific data.
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7499 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7500 HTREEITEM API dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata)
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
7501 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7502 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
7503 }
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7504
61869769c050 Sync with the latest DW code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 58
diff changeset
7505 /*
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
7506 * 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
7507 * 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
7508 * 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
7509 * 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
7510 * 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
7511 * 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
7512 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7513 void API dw_tree_item_change(HWND handle, HTREEITEM item, char *title, HICN 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
7514 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7515 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7516
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7517 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7518 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7519
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7520 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7521 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7522
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7523 pci->rc.pszIcon = (PSZ)strdup(title);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7524 pci->rc.hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7525
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7526 pci->hptrIcon = icon;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7527
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7528 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_TEXTCHANGED));
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
7529 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7530
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7531 /*
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
7532 * 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
7533 * 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
7534 * 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
7535 * 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
7536 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7537 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
7538 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7539 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7540
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7541 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7542 if(pci)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7543 return (char *)pci->rc.pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7544 return NULL;
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
7545 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7546
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7547 /*
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7548 * 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
7549 * 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
7550 * 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
7551 * 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
7552 */
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7553 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
7554 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7555 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7556
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7557 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7558 if(pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7559 return pci->parent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7560 return (HTREEITEM)0;
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
7561 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7562
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
7563 /*
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
7564 * 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
7565 * 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
7566 * 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
7567 * 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
7568 * 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
7569 */
513
7755599311d4 Fixes search and replace errors.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 511
diff changeset
7570 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
7571 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7572 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7573
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7574 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7575 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7576 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7577
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7578 pci->user = 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
7579 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7580
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7581 /*
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
7582 * 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
7583 * Parameters:
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
7584 * 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
7585 * 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
7586 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7587 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
7588 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7589 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7590
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7591 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7592 if(!pci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7593 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7594 return pci->user;
317
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
7595 }
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
7596
83edbd751da9 Added dw_tree_get_data() to get a tree item's data.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 315
diff changeset
7597 /*
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
7598 * 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
7599 * 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
7600 * 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
7601 * 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
7602 */
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
7603 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
7604 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7605 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7606
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7607 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7608 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7609 if(pCore->flRecordAttr & CRA_SELECTED)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7610 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7611 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7612 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7613 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)item, MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7614 lastitem = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7615 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
7616 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7617
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7618 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7619 * Removes all nodes from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7620 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7621 * 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
7622 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7623 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
7624 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7625 dw_container_clear(handle, TRUE);
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7626 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7627
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7628 /*
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
7629 * 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
7630 * 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
7631 * 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
7632 * 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
7633 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7634 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
7635 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7636 WinSendMsg(handle, CM_EXPANDTREE, MPFROMP(item), 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
7637 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7638
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7639 /*
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7640 * 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
7641 * 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
7642 * 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
7643 * 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
7644 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7645 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
7646 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7647 WinSendMsg(handle, CM_COLLAPSETREE, MPFROMP(item), 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
7648 }
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7649
c4e1139d9872 Added new tree functions, and fixed a memory leak as well as use of
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 52
diff changeset
7650 /*
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7651 * Removes a node from a tree.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7652 * Parameters:
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7653 * 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
7654 * item: Handle to node to be deleted.
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7655 */
510
710f82598210 Change function names to be inline with Mark Hessling's Rexx/DW.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 508
diff changeset
7656 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
7657 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7658 PCNRITEM pci = (PCNRITEM)item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7659
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7660 if(!item)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7661 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7662
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7663 if(pci->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7664 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7665 free(pci->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7666 pci->rc.pszIcon = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7667 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7668
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7669 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pci, MPFROM2SHORT(1, CMA_INVALIDATE | CMA_FREE));
30
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7670 }
b1d7e8a28dfa Added tree view functions and signal.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 24
diff changeset
7671
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7672 /* 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
7673 typedef struct _containerinfo {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7674 int count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7675 void *data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7676 HWND handle;
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7677 } ContainerInfo;
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
7678
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7679 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7680 * Sets up the container columns.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7681 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7682 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7683 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7684 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7685 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7686 * separator: The column number that contains the main separator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7687 * (this item may only be used in OS/2)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7688 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7689 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
7690 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7691 PFIELDINFO details, first, left = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7692 FIELDINFOINSERT detin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7693 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7694 int z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7695 ULONG size = sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7696 ULONG *offStruct = malloc(count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7697 ULONG *tempflags = malloc((count+1) * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7698 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7699 ULONG *oldflags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7700
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7701 if(!offStruct || !tempflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7702 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7703
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7704 memcpy(tempflags, flags, count * sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7705 tempflags[count] = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7706
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7707 blah->data = tempflags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7708 blah->flags = separator;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7709
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7710 if(oldflags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7711 free(oldflags);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7712
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7713 while((first = (PFIELDINFO)WinSendMsg(handle, CM_QUERYDETAILFIELDINFO, 0, MPFROMSHORT(CMA_FIRST))) != NULL)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7714 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7715 WinSendMsg(handle, CM_REMOVEDETAILFIELDINFO, (MPARAM)&first, MPFROM2SHORT(1, CMA_FREE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7716 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7717
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7718 /* Figure out the offsets to the items in the struct */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7719 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7720 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7721 offStruct[z] = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7722 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7723 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7724 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7725 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7726 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7727 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7728 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7729 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7730 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7731 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7732 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7733
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7734 first = details = (PFIELDINFO)WinSendMsg(handle, CM_ALLOCDETAILFIELDINFO, MPFROMLONG(count), 0L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7735
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7736 if(!first)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7737 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7738 free(offStruct);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7739 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7740 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7741
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7742 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7743 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7744 if(z==separator-1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7745 left=details;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7746 details->cb = sizeof(FIELDINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7747 details->flData = flags[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7748 details->flTitle = CFA_FITITLEREADONLY;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7749 details->pTitleData = titles[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7750 details->offStruct = offStruct[z];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7751 details = details->pNextFieldInfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7752 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7753
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7754 detin.cb = sizeof(FIELDINFOINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7755 detin.fInvalidateFieldInfo = FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7756 detin.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7757 detin.cFieldInfoInsert = (ULONG)count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7758
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7759 WinSendMsg(handle, CM_INSERTDETAILFIELDINFO, MPFROMP(first), MPFROMP(&detin));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7760
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7761 if(count > separator && separator > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7762 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7763 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7764 cnri.pFieldInfoLast = left;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7765 cnri.xVertSplitbar = 150;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7766
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7767 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_PFIELDINFOLAST | CMA_XVERTSPLITBAR));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7768 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7769
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7770 cnri.flWindowAttr = CV_DETAIL | CV_MINI | CA_DETAILSVIEWTITLES;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7771 cnri.slBitmapOrIcon.cx = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7772 cnri.slBitmapOrIcon.cy = 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7773
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7774 WinSendMsg(handle, CM_SETCNRINFO, &cnri, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7775
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7776 free(offStruct);
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
7777 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7778 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7779
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7780 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7781 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7782 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7783 * handle: Handle to the container to be configured.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7784 * flags: An array of unsigned longs with column flags.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7785 * titles: An array of strings with column text titles.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7786 * count: The number of columns (this should match the arrays).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7787 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7788 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7789 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7790 char **newtitles = malloc(sizeof(char *) * (count + 2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7791 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7792
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7793 newtitles[0] = "Icon";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7794 newtitles[1] = "Filename";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7795
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7796 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7797 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7798
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7799 memcpy(&newtitles[2], titles, sizeof(char *) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7800 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7801
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7802 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7803
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7804 free(newtitles);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7805 free(newflags);
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
7806 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7807 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7808
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7809 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7810 * Obtains an icon from a module (or header in GTK).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7811 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7812 * module: Handle to module (DLL) in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7813 * id: A unsigned long id int the resources on OS/2 and
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7814 * Windows, on GTK this is converted to a pointer
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7815 * to an embedded XPM.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7816 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7817 HICN API dw_icon_load(unsigned long module, unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7818 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7819 return WinLoadPointer(HWND_DESKTOP,module,id);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7820 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7821
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7822 /*
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
7823 * 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
7824 * 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
7825 * 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
7826 * 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
7827 * (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
7828 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7829 HICN API dw_icon_load_from_file(char *filename)
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
7830 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7831 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7832
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7833 if(!file)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7834 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7835
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7836 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7837
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7838 /* check if we can read from this file (it exists and read permission) */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7839 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7840 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7841 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7842 strcat(file, ".ico");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7843 if(access(file, 04) != 0)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7844 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7845 }
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7846 return WinLoadFileIcon((PSZ)file, FALSE);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7847 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7848
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7849 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7850 * Obtains an icon from data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7851 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7852 * filename: Name of the file, omit extention to have
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7853 * DW pick the appropriate file extension.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7854 * (ICO on OS/2 or Windows, XPM on Unix)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7855 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7856 HICN API dw_icon_load_from_data(char *data, int len)
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7857 {
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7858 HICN icon=0;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7859 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7860 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7861
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7862 if ( !data )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7863 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7864 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7865 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7866 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7867 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7868 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7869 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7870 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7871 fclose( fp );
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
7872 icon = WinLoadFileIcon( (PSZ)file, FALSE );
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7873 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7874 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7875 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7876 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7877 return 0;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7878 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7879 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7880 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7881 return icon;
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
7882 }
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
7883
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
7884 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7885 * Frees a loaded resource in OS/2 and Windows.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7886 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7887 * handle: Handle to icon returned by dw_icon_load().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7888 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
7889 void API dw_icon_free(HICN handle)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7890 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
7891 WinDestroyPointer(handle);
3
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 * Allocates memory used to populate a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7896 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7897 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7898 * rowcount: The number of items to be populated.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7899 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
7900 void * API dw_container_alloc(HWND handle, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7901 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7902 WindowData *wd = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7903 ULONG *flags = wd ? wd->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7904 int z, size = 0, totalsize, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7905 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7906 ContainerInfo *ci;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7907 void *blah = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7908
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7909 if(!flags || rowcount < 1)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7910 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7911
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7912 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7913 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7914
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7915 /* Figure out the offsets to the items in the struct */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7916 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7917 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7918 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7919 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7920 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7921 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7922 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7923 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7924 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7925 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7926 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7927 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7928 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7929
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7930 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7931
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7932 z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7933
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7934 if(!(blah = (void *)_dw_send_msg(handle, CM_ALLOCRECORD, MPFROMLONG(size), MPFROMLONG(rowcount), 0)))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7935 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7936
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7937 temp = (PRECORDCORE)blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7938
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7939 for(z=0;z<rowcount;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7940 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7941 temp->cb = totalsize;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7942 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7943 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7944
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7945 ci = malloc(sizeof(struct _containerinfo));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7946
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7947 ci->count = rowcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7948 ci->data = blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7949 ci->handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7950
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7951 return (void *)ci;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7952 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7953
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
7954 /* 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
7955 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
7956 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7957 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7958 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7959 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7960 CNRINFO cnr;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7961 void *dest;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
7962
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7963 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7964 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7965
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7966 if(!_dw_send_msg(handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7967 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7968
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7969 currentcount = cnr.cRecords;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7970
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7971 /* Figure out the offsets to the items in the struct */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7972 for(z=0;z<column;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7973 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7974 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7975 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7976 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7977 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7978 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7979 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7980 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7981 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7982 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7983 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7984 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7985
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7986 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7987
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7988 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7989 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7990
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7991 dest = (void *)(((ULONG)temp)+((ULONG)totalsize));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7992
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7993 if(flags[column] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7994 memcpy(dest, data, sizeof(HPOINTER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7995 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7996 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7997 char **newstr = (char **)data, **str = dest;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7998
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
7999 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8000 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8001
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8002 if(newstr && *newstr)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8003 *str = strdup(*newstr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8004 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8005 *str = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8006 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8007 else if(flags[column] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8008 memcpy(dest, data, sizeof(ULONG));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8009 else if(flags[column] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8010 memcpy(dest, data, sizeof(CDATE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8011 else if(flags[column] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8012 memcpy(dest, data, sizeof(CTIME));
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
8013 }
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
8014
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
8015 /* 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
8016 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
8017 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8018 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8019 ULONG totalsize, size = 0, *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8020 int z, count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8021
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8022 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8023 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8024
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8025 while(flags[count])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8026 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8027
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8028 /* Figure out the offsets to the items in the struct */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8029 for(z=0;z<count;z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8030 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8031 if(flags[z] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8032 size += sizeof(HPOINTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8033 else if(flags[z] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8034 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8035 char **str;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8036
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8037 totalsize = size + sizeof(RECORDCORE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8038
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8039 str = (char **)(((ULONG)temp)+((ULONG)totalsize));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8040
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8041 if(*str)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8042 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8043 free(*str);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8044 *str = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8045 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8046 size += sizeof(char *);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8047 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8048 else if(flags[z] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8049 size += sizeof(ULONG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8050 else if(flags[z] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8051 size += sizeof(CDATE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8052 else if(flags[z] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8053 size += sizeof(CTIME);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8054 }
326
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
8055 }
1c961a4d0f43 Old container code cleanups, and container code now allocates memory to
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 317
diff changeset
8056
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8057 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8058 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8059 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8060 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8061 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8062 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8063 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8064 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8065 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8066 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
8067 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8068 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8069
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8070 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8071 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8072
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8073 _dw_container_set_item(handle, (PRECORDCORE)ci->data, column, row, data);
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8074 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8075
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8076 /*
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8077 * 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
8078 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8079 * 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
8080 * 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
8081 * 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
8082 * 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
8083 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8084 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
8085 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8086 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8087 int count = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8088
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8089 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8090 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8091 if(count == row)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8092 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8093 _dw_container_set_item(handle, pCore, column, 0, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8094 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8095 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8096 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8097 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8098 count++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8099 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8100 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8101
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8102 /*
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8103 * 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
8104 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8105 * 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
8106 * 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
8107 * 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
8108 * 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
8109 */
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8110 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
8111 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8112 dw_container_change_item(handle, column + 2, row, data);
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8113 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8114
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8115 /*
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8116 * 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
8117 * Parameters:
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8118 * 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
8119 * 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
8120 * 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
8121 * 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
8122 * 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
8123 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
8124 void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon)
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8125 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8126 dw_container_change_item(handle, 0, row, (void *)&icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8127 dw_container_change_item(handle, 1, row, (void *)&filename);
503
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8128 }
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8129
f3ed8dda02f8 Added dw_filesystem_change_*() and testcase code from Mark in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 500
diff changeset
8130 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8131 * 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
8132 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8133 * 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
8134 * 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
8135 * 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
8136 * 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
8137 * 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
8138 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
8139 void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8140 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8141 dw_container_set_item(handle, pointer, 0, row, (void *)&icon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8142 dw_container_set_item(handle, pointer, 1, row, (void *)&filename);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8143 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8144
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8145 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8146 * Sets an item in specified row and column to the given data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8147 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8148 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8149 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8150 * column: Zero based column of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8151 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8152 * data: Pointer to the data to be added.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8153 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8154 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
8155 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8156 dw_container_set_item(handle, pointer, column + 2, row, data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8157 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8158
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8159 /*
508
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8160 * 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
8161 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8162 * 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
8163 * 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
8164 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8165 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
8166 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8167 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8168 ULONG *flags = blah ? blah->data : 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8169 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8170
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8171 if(!flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8172 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8173
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8174 if(flags[column] & DW_CFA_BITMAPORICON)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8175 rc = DW_CFA_BITMAPORICON;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8176 else if(flags[column] & DW_CFA_STRING)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8177 rc = DW_CFA_STRING;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8178 else if(flags[column] & DW_CFA_ULONG)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8179 rc = DW_CFA_ULONG;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8180 else if(flags[column] & DW_CFA_DATE)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8181 rc = DW_CFA_DATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8182 else if(flags[column] & DW_CFA_TIME)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8183 rc = DW_CFA_TIME;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8184 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8185 rc = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8186 return rc;
508
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8187 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8188
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8189 /*
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8190 * 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
8191 * Parameters:
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8192 * 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
8193 * 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
8194 */
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8195 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
8196 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8197 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
8198 }
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8199
078a40ba2e41 Added dw_container_get_column_type and dw_filesystem_get_column_type.
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 507
diff changeset
8200 /*
1208
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8201 * Sets the alternating row colors for container window (widget) handle.
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8202 * Parameters:
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8203 * handle: The window (widget) handle.
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8204 * oddcolor: Odd row background color in DW_RGB format or a default color index.
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8205 * evencolor: Even row background color in DW_RGB format or a default color index.
1211
70dca53cb071 Updated GTK3 with the behavior change just commited for Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1208
diff changeset
8206 * DW_RGB_TRANSPARENT will disable coloring rows.
70dca53cb071 Updated GTK3 with the behavior change just commited for Mac.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1208
diff changeset
8207 * DW_CLR_DEFAULT will use the system default alternating row colors.
1208
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8208 */
1291
b99b0b2c2826 Renamed dw_container_set_row_bg() to dw_container_set_stripe().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1290
diff changeset
8209 void API dw_container_set_stripe(HWND handle, unsigned long oddcolor, unsigned long evencolor)
1208
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8210 {
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8211 /* Don't think this is possible on OS/2 */
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8212 }
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8213
53547c9c99a2 Added dw_container_set_row_bg() stubs on the remaining platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1199
diff changeset
8214 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8215 * 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
8216 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8217 * 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
8218 * 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
8219 * 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
8220 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8221 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
8222 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8223 handle = handle; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8224 column = column; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8225 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
8226 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8227
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8228 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8229 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8230 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8231 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8232 * row: Zero based row of data being set.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8233 * title: String title of the item.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8234 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8235 void API dw_container_set_row_title(void *pointer, int row, char *title)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8236 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8237 ContainerInfo *ci = (ContainerInfo *)pointer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8238 PRECORDCORE temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8239 int z, currentcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8240 CNRINFO cnr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8241
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8242 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8243 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8244
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8245 temp = (PRECORDCORE)ci->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8246
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8247 z = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8248
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8249 if(!_dw_send_msg(ci->handle, CM_QUERYCNRINFO, (MPARAM)&cnr, MPFROMSHORT(sizeof(CNRINFO)), 0))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8250 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8251
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8252 currentcount = cnr.cRecords;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8253
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8254 for(z=0;z<(row-currentcount);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8255 temp = temp->preccNextRecord;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8256
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8257 temp->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8258 temp->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8259 temp->pszText = (PSZ)title;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8260 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8261
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8262 /*
819
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8263 * Changes the title of a row already inserted in the container.
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8264 * Parameters:
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8265 * handle: Handle to the container window (widget).
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8266 * row: Zero based row of data being set.
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8267 * title: String title of the item.
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8268 */
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8269 void API dw_container_change_row_title(HWND handle, int row, char *title)
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8270 {
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8271 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8272 int count = 0;
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8273
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8274 while(pCore)
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8275 {
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8276 if(count == row)
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8277 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8278 pCore->pszIcon = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8279 pCore->pszName = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8280 pCore->pszText = (PSZ)title;
819
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8281
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8282 WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED));
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8283 return;
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8284 }
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8285 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8286 count++;
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8287 }
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8288 }
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8289
1019
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8290 /* Internal function to get the first item with given flags */
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8291 PRECORDCORE _dw_container_start(HWND handle, unsigned long flags)
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8292 {
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8293 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8294
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8295 if(pCore)
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8296 {
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8297 while(pCore)
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8298 {
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8299 if(pCore->flRecordAttr & flags)
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8300 {
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8301 return pCore;
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8302 }
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8303 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8304 }
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8305 }
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8306 return NULL;
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8307 }
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8308
819
2dd7638a7719 Fix for some dw_container_change_item() misbehavior... was functioning the same as dw_container_set_item().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 672
diff changeset
8309 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8310 * Sets the title of a row in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8311 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8312 * handle: Handle to the container window (widget).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8313 * pointer: Pointer to the allocated memory in dw_container_alloc().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8314 * rowcount: The number of rows to be inserted.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8315 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8316 void API dw_container_insert(HWND handle, void *pointer, int rowcount)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8317 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8318 RECORDINSERT recin;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8319 ContainerInfo *ci = (ContainerInfo *)pointer;
1019
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8320 PRECORDCORE pCore;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8321
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8322 if(!ci)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8323 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8324
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8325 recin.cb = sizeof(RECORDINSERT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8326 recin.pRecordOrder = (PRECORDCORE)CMA_END;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8327 recin.pRecordParent = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8328 recin.zOrder = CMA_TOP;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8329 recin.fInvalidateRecord = TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8330 recin.cRecordsInsert = rowcount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8331
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8332 _dw_send_msg(handle, CM_INSERTRECORD, MPFROMP(ci->data), MPFROMP(&recin), 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8333
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8334 free(ci);
1019
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8335
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8336 if((pCore = _dw_container_start(handle, CRA_CURSORED)))
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8337 {
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8338 NOTIFYRECORDEMPHASIS pre;
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8339
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8340 pre.pRecord = pCore;
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8341 pre.fEmphasisMask = CRA_CURSORED;
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8342 pre.hwndCnr = handle;
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8343 _run_event(handle, WM_CONTROL, MPFROM2SHORT(0, CN_EMPHASIS), (MPARAM)&pre);
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8344 pre.pRecord->flRecordAttr |= CRA_CURSORED;
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8345 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8346 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8347
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8348 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8349 * Removes all rows from a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8350 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8351 * 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
8352 * 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
8353 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8354 void API dw_container_clear(HWND handle, int redraw)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8355 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8356 PCNRITEM pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8357 int container = (int)dw_window_get_data(handle, "_dw_container");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8358
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8359 if(hwndEmph == handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8360 _clear_emphasis();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8361
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8362 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8363
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8364 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8365 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8366 if(container)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8367 _dw_container_free_strings(handle, (PRECORDCORE)pCore);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8368 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8369 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8370 /* Free icon text */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8371 if(pCore->rc.pszIcon)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8372 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8373 free(pCore->rc.pszIcon);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8374 pCore->rc.pszIcon = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8375 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8376 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8377 pCore = (PCNRITEM)pCore->rc.preccNextRecord;/*WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));*/
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8378 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8379 _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
8380 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8381
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8382 /*
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8383 * 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
8384 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8385 * 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
8386 * 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
8387 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8388 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
8389 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8390 RECORDCORE *last, **prc = malloc(sizeof(RECORDCORE *) * rowcount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8391 int current = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8392
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8393 prc[0] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8394
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8395 while(last && current < rowcount)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8396 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8397 _dw_container_free_strings(handle, last);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8398 prc[current] = last = (RECORDCORE *)WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)last, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8399 current++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8400 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8401
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8402 _dw_send_msg(handle, CM_REMOVERECORD, (MPARAM)prc, MPFROM2SHORT(current, CMA_INVALIDATE | CMA_FREE), -1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8403
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8404 free(prc);
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8405 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8406
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8407 /*
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8408 * 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
8409 * Parameters:
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8410 * 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
8411 * 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
8412 * 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
8413 * 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
8414 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8415 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
8416 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8417 rows = rows; /* keep compiler happy */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8418 switch(direction)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8419 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8420 case DW_SCROLL_TOP:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8421 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-10000000));
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8422 break;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8423 case DW_SCROLL_BOTTOM:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8424 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(10000000));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8425 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8426 }
22
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8427 }
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8428
6a246b3bb14f Added tree widgets, fixed some delete event processing, fixed a layout bug
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 21
diff changeset
8429 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8430 * Starts a new query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8431 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8432 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8433 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8434 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8435 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8436 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8437 char * API dw_container_query_start(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8438 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8439 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8440
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8441 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8442 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8443 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8444 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8445 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8446 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8447 if(pCore->flRecordAttr & flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8448 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8449 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8450 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8451 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8452 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8453 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8454 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8455 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8456 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8457 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8458 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8459 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8460 }
1019
452388c9c3d8 Attempt at fixing no SELECT event being triggered during container insertion on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1016
diff changeset
8461 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8462 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8463
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8464 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8465 * Continues an existing query of a container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8466 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8467 * handle: Handle to the window (widget) to be queried.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8468 * flags: If this parameter is DW_CRA_SELECTED it will only
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8469 * return items that are currently selected. Otherwise
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8470 * it will return all records in the container.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8471 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8472 char * API dw_container_query_next(HWND handle, unsigned long flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8473 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8474 PRECORDCORE pCore = (PRECORDCORE)dw_window_get_data(handle, "_dw_pcore");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8475
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8476 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8477
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8478 if(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8479 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8480 if(flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8481 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8482 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8483 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8484 if(pCore->flRecordAttr & flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8485 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8486 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8487 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8488 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8489
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8490 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8491 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8492 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8493 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8494 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8495 dw_window_set_data(handle, "_dw_pcore", (void *)pCore);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8496 return (char *)pCore->pszIcon;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8497 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8498 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8499 return NULL;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8500 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8501
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8502 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8503 * 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
8504 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8505 * 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
8506 * 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
8507 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8508 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
8509 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8510 RECTL viewport, item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8511 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
1322
3f1ac800bf65 Initial fix for being able to do container string comparisons instead of pointer on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1316
diff changeset
8512 int textcomp = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_textcomp"));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8513
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8514 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8515 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8516 if((textcomp && pCore->pszIcon && strcmp((char *)pCore->pszIcon, text) == 0) || (!textcomp && (char *)pCore->pszIcon == text))
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8517 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8518 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8519 int scrollpixels = 0, midway;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8520
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8521 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8522 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8523 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8524 qrr.fsExtent = CMA_TEXT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8525
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8526 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(TRUE, CRA_CURSORED));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8527 WinSendMsg(handle, CM_QUERYVIEWPORTRECT, (MPARAM)&viewport, MPFROM2SHORT(CMA_WORKSPACE, FALSE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8528 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8529
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8530 midway = (viewport.yTop - viewport.yBottom)/2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8531 scrollpixels = viewport.yTop - (item.yTop + midway);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8532
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8533 WinSendMsg(handle, CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(scrollpixels));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8534 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8535 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8536
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8537 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8538 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8539 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8540
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8541 /*
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8542 * 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
8543 * Parameters:
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8544 * 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
8545 * 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
8546 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8547 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
8548 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8549 PRECORDCORE pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
1322
3f1ac800bf65 Initial fix for being able to do container string comparisons instead of pointer on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1316
diff changeset
8550 int textcomp = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_textcomp"));
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8551
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8552 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8553 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8554 if((textcomp && pCore->pszIcon && strcmp((char *)pCore->pszIcon, text) == 0) || (!textcomp && (char *)pCore->pszIcon == text))
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8555 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8556 WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8557 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8558 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8559 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8560 }
167
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8561 }
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8562
0b3debaa9c6c Added new container functions, and fixed resource leaks.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 166
diff changeset
8563 /*
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8564 * 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
8565 * Parameters:
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8566 * 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
8567 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8568 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
8569 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8570 WindowData *blah = (WindowData *)WinQueryWindowPtr(handle, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8571 RECTL item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8572 PRECORDCORE pCore = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8573 int max = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8574
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8575 if(blah && !blah->flags)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8576 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8577
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8578 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8579 while(pCore)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8580 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8581 QUERYRECORDRECT qrr;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8582 int vector;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8583
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8584 qrr.cb = sizeof(QUERYRECORDRECT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8585 qrr.pRecord = pCore;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8586 qrr.fRightSplitWindow = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8587 qrr.fsExtent = CMA_TEXT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8588
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8589 WinSendMsg(handle, CM_QUERYRECORDRECT, (MPARAM)&item, (MPARAM)&qrr);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8590
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8591 vector = item.xRight - item.xLeft;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8592
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8593 if(vector > max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8594 max = vector;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8595
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8596 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8597 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8598
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8599 if(max)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8600 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8601 CNRINFO cnri;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8602
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8603 cnri.cb = sizeof(CNRINFO);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8604 cnri.xVertSplitbar = max;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8605
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8606 WinSendMsg(handle, CM_SETCNRINFO, MPFROMP(&cnri), MPFROMLONG(CMA_XVERTSPLITBAR));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8607 }
69
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8608 }
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8609
9510897c0b03 Added new container functions, and implemented some missing functionality.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 68
diff changeset
8610 /*
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8611 * 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
8612 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8613 * 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
8614 * 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
8615 * 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
8616 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
8617 void API dw_taskbar_insert(HWND handle, HICN 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
8618 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8619 /* Make sure we have our server */
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8620 if(!hwndTrayServer)
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8621 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8622
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8623 WinSendMsg(hwndApp, WM_SETICON, (MPARAM)icon, 0);
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8624 hwndTaskBar = handle;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8625 WinPostMsg(hwndTrayServer, WM_USER+1, (MPARAM)hwndApp, (MPARAM)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
8626 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8627
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8628 /*
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8629 * 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
8630 * Parameters:
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8631 * 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
8632 * 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
8633 */
671
c60a4f6cfae8 Implemented icon support on the Mac. In the process created a new HICN type.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 643
diff changeset
8634 void API dw_taskbar_delete(HWND handle, HICN 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
8635 {
1226
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8636 /* Make sure we have our server */
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8637 if(!hwndTrayServer)
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8638 return;
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8639
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8640 WinPostMsg(hwndTrayServer, WM_USER+2, (MPARAM)hwndApp, (MPARAM)0);
d865c29fc06a Added taskbar support for OS/2 using the System Tray XCenter plugin.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1211
diff changeset
8641 hwndTaskBar = NULLHANDLE;
487
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8642 }
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8643
d6e07d292145 Implemented taskbar icons on windows, so I can keep feature for feature
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 485
diff changeset
8644 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8645 * Creates a rendering context widget (window) to be packed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8646 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8647 * id: An id to be used with dw_window_from_id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8648 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8649 * A handle to the widget or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8650 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8651 HWND API dw_render_new(unsigned long id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8652 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8653 HWND hwndframe = WinCreateWindow(HWND_OBJECT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8654 WC_FRAME,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8655 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8656 WS_VISIBLE |
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8657 FS_NOBYTEALIGN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8658 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8659 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8660 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8661 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8662 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8663 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8664 WinSubclassWindow(hwndframe, _RendProc);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8665 return hwndframe;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8666 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8667
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8668 /* Sets the current foreground drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8669 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8670 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8671 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8672 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8673 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8674 void API dw_color_foreground_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8675 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8676 _foreground = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8677 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8678
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8679 /* Sets the current background drawing color.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8680 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8681 * red: red value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8682 * green: green value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8683 * blue: blue value.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8684 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8685 void API dw_color_background_set(unsigned long value)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8686 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8687 _background = value;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8688 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8689
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
8690 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
8691 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8692 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8693 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8694 void *val;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8695
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8696 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8697 val = dw_window_get_data(window, "_dw_val");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8698
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8699 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8700 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8701 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8702 dw_dialog_dismiss((DWDialog *)data, val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8703 return FALSE;
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
8704 }
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
8705
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
8706 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
8707 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8708 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8709 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8710 unsigned long val;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8711
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8712 window = (HWND)dwwait->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8713 val = _dw_color_spin_get(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8714
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8715 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8716 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8717 dw_window_destroy(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8718 dw_dialog_dismiss((DWDialog *)data, (void *)val);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8719 return FALSE;
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
8720 }
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
8721
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8722 /* 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
8723 * Parameters:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8724 * value: current color
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8725 * Returns:
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8726 * The selected color or the current color if cancelled.
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8727 */
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8728 unsigned long API dw_color_choose(unsigned long value)
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8729 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8730 HWND window, hbox, vbox, col, button, text;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8731 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8732 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8733
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8734 window = dw_window_new( HWND_DESKTOP, "Choose Color", FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8735
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8736 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8737
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8738 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8739
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8740 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8741
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8742 dw_box_pack_start(vbox, hbox, 0, 0, FALSE, FALSE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8743 dw_window_set_style(hbox, 0, WS_CLIPCHILDREN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8744
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8745 col = WinCreateWindow(vbox, (PSZ)"ColorSelectClass", NULL, WS_VISIBLE | WS_GROUP, 0, 0, 390, 300, vbox, HWND_TOP, 266, NULL,NULL);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8746 dw_box_pack_start(hbox, col, 390, 300, FALSE, FALSE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8747
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8748 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8749 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8750 dw_window_set_data(window, "_dw_col", (void *)col);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8751 dw_window_set_data(window, "_dw_val", (void *)value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8752
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8753 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8754 dw_window_set_data(hbox, "_dw_window", (void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8755
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8756 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8757
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8758 text = dw_text_new("Red:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8759 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8760 dw_box_pack_start(hbox, text, 30, 20, FALSE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8761
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8762 button = dw_spinbutton_new("", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8763 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8764 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8765 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8766 dw_window_set_data(window, "_dw_red_spin", (void *)button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8767
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8768 text = dw_text_new("Green:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8769 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8770 dw_box_pack_start(hbox, text, 30, 20, FALSE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8771
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8772 button = dw_spinbutton_new("", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8773 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8774 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8775 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8776 dw_window_set_data(window, "_dw_green_spin", (void *)button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8777
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8778 text = dw_text_new("Blue:", 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8779 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8780 dw_box_pack_start(hbox, text, 30, 20, FALSE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8781
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8782 button = dw_spinbutton_new("", 1003L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8783 dw_spinbutton_set_limits(button, 255, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8784 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8785 WinSetOwner(button, hbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8786 dw_window_set_data(window, "_dw_blue_spin", (void *)button);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8787
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8788 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8789
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8790 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8791 dw_box_pack_start(hbox, 0, 100, 1, TRUE, FALSE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8792
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8793 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8794 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8795
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8796 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8797
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8798 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_color_ok_func), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8799
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8800 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8801 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8802
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8803 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_color_cancel_func), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8804 dw_signal_connect(window, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(_dw_color_cancel_func), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8805
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8806 dw_window_set_size(window, 400, 400);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8807
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8808 _dw_col_set(col, value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8809 _dw_color_spin_set(window, value);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8810
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8811 dw_window_show(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8812
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8813 return (unsigned long)dw_dialog_wait(dwwait);
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8814 }
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
8815
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8816 HPS _set_hps(HPS hps)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8817 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8818 LONG alTable[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8819
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8820 alTable[0] = DW_RED_VALUE(_foreground) << 16 | DW_GREEN_VALUE(_foreground) << 8 | DW_BLUE_VALUE(_foreground);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8821 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8822
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8823 GpiCreateLogColorTable(hps,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8824 LCOL_RESET,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8825 LCOLF_CONSECRGB,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8826 16,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8827 2,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8828 alTable);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8829 if(_foreground & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8830 GpiSetColor(hps, 16);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8831 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8832 GpiSetColor(hps, _internal_color(_foreground));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8833 if(_background & DW_RGB_COLOR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8834 GpiSetBackColor(hps, 17);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8835 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8836 GpiSetBackColor(hps, _internal_color(_background));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8837 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8838 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8839
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8840 HPS _set_colors(HWND handle)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8841 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8842 HPS hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8843
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8844 _set_hps(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8845 return hps;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8846 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8847
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8848 /* Draw a point on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8849 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8850 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8851 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8852 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8853 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8854 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8855 void API dw_draw_point(HWND handle, HPIXMAP pixmap, int x, int y)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8856 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8857 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8858 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8859 POINTL ptl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8860
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8861 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8862 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8863 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8864 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8865 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8866 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8867 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8868 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8869 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8870 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8871 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8872 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8873
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8874 ptl.x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8875 ptl.y = height - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8876
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8877 GpiSetPel(hps, &ptl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8878 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8879 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8880 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8881
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8882 /* Draw a line on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8883 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8884 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8885 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8886 * x1: First X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8887 * y1: First Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8888 * x2: Second X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8889 * y2: Second Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8890 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8891 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
8892 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8893 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8894 int height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8895 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8896
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8897 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8898 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8899 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8900 height = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8901 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8902 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8903 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8904 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8905 height = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8906 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8907 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8908 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8909
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8910 ptl[0].x = x1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8911 ptl[0].y = height - y1 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8912 ptl[1].x = x2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8913 ptl[1].y = height - y2 - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8914
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8915 GpiMove(hps, &ptl[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8916 GpiLine(hps, &ptl[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8917
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8918 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8919 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8920 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8921
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8922
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
8923 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
8924 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8925 FONTMETRICS fm;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8926 FATTRS fat;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8927 SIZEF sizf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8928
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8929 GpiQueryFontMetrics(hpsSrc, sizeof(FONTMETRICS), &fm);
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
8930
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
8931 memset(&fat, 0, sizeof(fat));
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
8932
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8933 fat.usRecordLength = sizeof(FATTRS);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8934 fat.lMatch = fm.lMatch;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8935 strcpy(fat.szFacename, fm.szFacename);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8936
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8937 GpiCreateLogFont(hpsDst, 0, 1L, &fat);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8938 GpiSetCharSet(hpsDst, 1L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8939
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8940 sizf.cx = MAKEFIXED(fm.lEmInc,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8941 sizf.cy = MAKEFIXED(fm.lMaxBaselineExt,0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
8942 GpiSetCharBox(hpsDst, &sizf );
9
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
8943 }
3383ed751a7e New font rendering code in dw_draw_text(). Slightly less flexible but
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 8
diff changeset
8944
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8945 /* Draw text on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8946 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8947 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8948 * pixmap: Handle to the pixmap. (choose only one of these)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8949 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8950 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8951 * text: Text to be displayed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
8952 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
8953 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
8954 {
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8955 HPS hps;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8956 int z, height;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8957 RECTL rcl;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8958 char fontname[128];
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8959 POINTL aptl[TXTBOX_COUNT];
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8960
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8961 if(handle)
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8962 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8963 hps = _set_colors(handle);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8964 height = _get_height(handle);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8965 _GetPPFont(handle, fontname);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8966 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8967 else if(pixmap)
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8968 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8969 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8970
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8971 hps = _set_hps(pixmap->hps);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8972 height = pixmap->height;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8973 _GetPPFont(pixmap->font ? pixmap->font : pixmap->handle, fontname);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8974 _CopyFontSettings(pixmaphps, hps);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8975 WinReleasePS(pixmaphps);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8976 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8977 else
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8978 return;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8979
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8980 for(z=0;z<strlen(fontname);z++)
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8981 {
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8982 if(fontname[z]=='.')
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8983 break;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8984 }
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8985
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8986 GpiQueryTextBox(hps, strlen(text), (PCH)text, TXTBOX_COUNT, aptl);
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8987
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8988 rcl.xLeft = x;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8989 rcl.yTop = height - y;
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8990 rcl.yBottom = rcl.yTop - (aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8991 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8992
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8993 if(_background == DW_CLR_DEFAULT)
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8994 WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS);
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8995 else
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
8996 WinDrawText(hps, -1, (PCH)text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT);
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8997
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8998 if(!pixmap)
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
8999 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9000 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9001
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
9002 /* 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
9003 * 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
9004 * 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
9005 * 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
9006 * 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
9007 * 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
9008 * 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
9009 */
514
08d770271709 More function name changes for Rexx/DW compatibility.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 513
diff changeset
9010 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
9011 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9012 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9013 POINTL aptl[TXTBOX_COUNT];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9014
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9015 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9016 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9017 hps = _set_colors(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9018 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9019 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9020 {
1233
365f92e85771 Fix for dw_font_text_extents_get() on OS/2 not honoring the font set with dw_pixmap_set_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1226
diff changeset
9021 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9022
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9023 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9024 _CopyFontSettings(pixmaphps, hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9025 WinReleasePS(pixmaphps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9026 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9027 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9028 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9029
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9030 GpiQueryTextBox(hps, strlen(text), (PCH)text, TXTBOX_COUNT, aptl);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9031
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9032 if(width)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9033 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9034
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9035 if(height)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9036 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9037
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9038 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9039 WinReleasePS(hps);
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
9040 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9041
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9042 /* Draw a polygon on a window (preferably a render window).
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9043 * Parameters:
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9044 * handle: Handle to the window.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9045 * pixmap: Handle to the pixmap. (choose only one of these)
1275
0b34e2cf0706 Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1274
diff changeset
9046 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0).
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9047 * x: X coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9048 * y: Y coordinate.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9049 * width: Width of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9050 * height: Height of rectangle.
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9051 */
1275
0b34e2cf0706 Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1274
diff changeset
9052 void API dw_draw_polygon( HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9053 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9054 HPS hps;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9055 int thisheight;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9056 POINTL *pptl;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9057 POINTL start;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9058 int i;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9059
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9060 if(handle)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9061 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9062 hps = _set_colors(handle);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9063 thisheight = _get_height(handle);
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9064 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9065 else if(pixmap)
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9066 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9067 hps = _set_hps(pixmap->hps);
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9068 thisheight = pixmap->height;
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9069 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9070 else
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9071 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9072 if ( npoints == 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9073 return;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9074 pptl = (POINTL *)malloc(sizeof(POINTL)*npoints);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9075 if ( pptl == NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9076 return;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9077 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9078 * For a filled polygon we need to start an area
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9079 */
1275
0b34e2cf0706 Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1274
diff changeset
9080 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9081 GpiBeginArea( hps, 0L );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9082 if ( npoints )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9083 {
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9084 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9085 * Move to the first point of the polygon
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9086 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9087 start.x = x[0];
1260
3cbd8de0b50b Fixed dw_draw_polygon on OS/2 not flipping the Y coordinates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1244
diff changeset
9088 start.y = thisheight - y[0] - 1;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9089 GpiMove( hps, &start );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9090 /*
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9091 * Convert the remainder of the x and y points
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9092 */
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9093 for ( i = 1; i < npoints; i++ )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9094 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9095 pptl[i-1].x = x[i];
1260
3cbd8de0b50b Fixed dw_draw_polygon on OS/2 not flipping the Y coordinates.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1244
diff changeset
9096 pptl[i-1].y = thisheight - y[i] - 1;
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9097 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9098 GpiPolyLine( hps, npoints-1, pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9099
1275
0b34e2cf0706 Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1274
diff changeset
9100 if ( flags & DW_DRAW_FILL )
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9101 GpiEndArea( hps );
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9102 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9103 if ( !pixmap )
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9104 WinReleasePS(hps);
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9105 free( pptl );
636
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9106 }
f6f887d2c5aa Add _dw_log() internal logging function
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 612
diff changeset
9107
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9108 /* Draw a rectangle on a window (preferably a render window).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9109 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9110 * handle: Handle to the window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9111 * pixmap: Handle to the pixmap. (choose only one of these)
1275
0b34e2cf0706 Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1274
diff changeset
9112 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0).
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9113 * x: X coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9114 * y: Y coordinate.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9115 * width: Width of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9116 * height: Height of rectangle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9117 */
1276
1cdc18d760e0 Fixed improper fill method in dw_draw_rect() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1275
diff changeset
9118 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9119 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9120 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9121 int thisheight;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9122 POINTL ptl[2];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9123
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9124 if(handle)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9125 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9126 hps = _set_colors(handle);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9127 thisheight = _get_height(handle);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9128 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9129 else if(pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9130 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9131 hps = _set_hps(pixmap->hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9132 thisheight = pixmap->height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9133 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9134 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9135 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9136
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9137 ptl[0].x = x;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9138 ptl[0].y = thisheight - y - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9139 ptl[1].x = x + width - 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9140 ptl[1].y = thisheight - y - height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9141
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9142 GpiMove(hps, &ptl[0]);
1276
1cdc18d760e0 Fixed improper fill method in dw_draw_rect() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1275
diff changeset
9143 GpiBox(hps, (flags & DW_DRAW_FILL) ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9144
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9145 if(!pixmap)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9146 WinReleasePS(hps);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9147 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9148
1262
4b0aa8429592 VisualAge on OS/2 is missing M_PI in math.h so define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1261
diff changeset
9149 /* VisualAge doesn't seem to have this */
4b0aa8429592 VisualAge on OS/2 is missing M_PI in math.h so define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1261
diff changeset
9150 #ifndef M_PI
4b0aa8429592 VisualAge on OS/2 is missing M_PI in math.h so define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1261
diff changeset
9151 #define M_PI 3.14159265358979323846
4b0aa8429592 VisualAge on OS/2 is missing M_PI in math.h so define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1261
diff changeset
9152 #endif
4b0aa8429592 VisualAge on OS/2 is missing M_PI in math.h so define it ourselves.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1261
diff changeset
9153
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9154 /* Draw an arc on a window (preferably a render window).
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9155 * Parameters:
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9156 * handle: Handle to the window.
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9157 * pixmap: Handle to the pixmap. (choose only one of these)
1275
0b34e2cf0706 Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1274
diff changeset
9158 * flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0).
0b34e2cf0706 Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1274
diff changeset
9159 * DW_DRAW_FULL will draw a complete circle/elipse.
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9160 * xorigin: X coordinate of center of arc.
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9161 * yorigin: Y coordinate of center of arc.
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9162 * x1: X coordinate of first segment of arc.
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9163 * y1: Y coordinate of first segment of arc.
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9164 * x2: X coordinate of second segment of arc.
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9165 * y2: Y coordinate of second segment of arc.
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9166 */
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9167 void API dw_draw_arc(HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9168 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9169 HPS hps;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9170 int thisheight;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9171 ARCPARAMS ap = { 1, 1, 0, 0 };
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9172 POINTL pts[2];
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9173 double r, a1, a2, a;
1274
885b55c0d7d7 Implemented DW_DRAW_FULL and DW_DRAW_FILL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1262
diff changeset
9174
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9175 if(handle)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9176 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9177 hps = _set_colors(handle);
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9178 thisheight = _get_height(handle);
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9179 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9180 else if(pixmap)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9181 {
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9182 hps = _set_hps(pixmap->hps);
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9183 thisheight = pixmap->height;
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9184 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9185 else
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9186 return;
1274
885b55c0d7d7 Implemented DW_DRAW_FULL and DW_DRAW_FILL on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1262
diff changeset
9187
1282
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9188 /* Handle full circle/ellipse */
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9189 if(flags & DW_DRAW_FULL)
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9190 {
1285
2c04a56eaf63 Switched to using arcparams and GpiFullArc on OS/2 to draw the ellipse.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1282
diff changeset
9191 pts[0].x = xorigin;
1286
6a5df80cfb43 Ug fix for editor adding tabs. Wish I could change the default in this thing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1285
diff changeset
9192 pts[0].y = thisheight - yorigin - 1;
1282
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9193 GpiMove(hps, pts);
1286
6a5df80cfb43 Ug fix for editor adding tabs. Wish I could change the default in this thing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1285
diff changeset
9194 ap.lP = (x2 - x1)/2;
6a5df80cfb43 Ug fix for editor adding tabs. Wish I could change the default in this thing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1285
diff changeset
9195 ap.lQ = (y2 - y1)/2;
6a5df80cfb43 Ug fix for editor adding tabs. Wish I could change the default in this thing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1285
diff changeset
9196 /* Setup the arc info on the presentation space */
6a5df80cfb43 Ug fix for editor adding tabs. Wish I could change the default in this thing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1285
diff changeset
9197 GpiSetArcParams(hps, &ap);
1290
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9198 GpiFullArc(hps, (flags & DW_DRAW_FILL) ? DRO_OUTLINEFILL : DRO_OUTLINE, MAKEFIXED(1, 1));
1285
2c04a56eaf63 Switched to using arcparams and GpiFullArc on OS/2 to draw the ellipse.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1282
diff changeset
9199 }
1282
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9200 else
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9201 {
1290
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9202 /* For a filled arc we need to start an area */
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9203 if(flags & DW_DRAW_FILL)
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9204 GpiBeginArea(hps, 0L);
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9205
1286
6a5df80cfb43 Ug fix for editor adding tabs. Wish I could change the default in this thing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1285
diff changeset
9206 /* Setup the default arc info on the presentation space */
6a5df80cfb43 Ug fix for editor adding tabs. Wish I could change the default in this thing.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1285
diff changeset
9207 GpiSetArcParams(hps, &ap);
1282
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9208 pts[0].x = x1;
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9209 pts[0].y = thisheight - y1 - 1;
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9210 /* Move to the initial position */
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9211 GpiMove(hps, pts);
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9212 /* Calculate the midpoint */
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9213 r = 0.5 * (hypot((double)(y1 - yorigin), (double)(x1 - xorigin)) +
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9214 hypot((double)(y2 - yorigin), (double)(x2 - xorigin)));
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9215 a1 = atan2((double)(y1 - yorigin), (double)(x1 - xorigin));
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9216 a2 = atan2((double)(y2 - yorigin), (double)(x2 - xorigin));
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9217 if(a2 < a1)
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9218 a2 += M_PI * 2;
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9219 a = (a1 + a2) / 2.;
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9220 /* Prepare to draw */
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9221 pts[0].x = (int)(xorigin + r * cos(a));
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9222 pts[0].y = thisheight - (int)(yorigin + r * sin(a)) - 1;
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9223 pts[1].x = x2;
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9224 pts[1].y = thisheight - y2 - 1;
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9225 /* Actually draw the arc */
4f0f816f1e76 Update to draw as an ellipse and fix for circles on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1278
diff changeset
9226 GpiPointArc(hps, pts);
1290
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9227 if(flags & DW_DRAW_FILL)
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9228 GpiEndArea(hps);
d2c4deea6bf6 Simplified fill for ellipses and circles on OS/2 using DRO_OUTLINEFILL.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1286
diff changeset
9229 }
1261
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9230
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9231 if(!pixmap)
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9232 WinReleasePS(hps);
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9233 }
61d0c5f84644 Initial attempt at adding dw_draw_arc() support on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1260
diff changeset
9234
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9235 /* Call this after drawing to the screen to make sure
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9236 * anything you have drawn is visible.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9237 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9238 void API dw_flush(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9239 {
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9240 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9241
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9242 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9243 * Creates a pixmap with given parameters.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9244 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9245 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9246 * width: Width of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9247 * height: Height of the pixmap in pixels.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9248 * depth: Color depth of the pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9249 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9250 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9251 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9252 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
9253 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9254 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9255 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9256 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9257 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9258 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9259 ULONG ulFlags;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9260 LONG cPlanes, cBitCount;
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9261
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9262 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9263 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9264
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9265 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9266
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9267 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9268 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9269
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9270 pixmap->handle = handle;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9271 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, (PSZ)"*", 0L, NULL, hdc);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9272 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9273
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9274 DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9275 if (!depth)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9276 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9277 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1L, &cBitCount);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9278 depth = cBitCount;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9279 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9280
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9281 memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9282 bmih.cbFix = sizeof(BITMAPINFOHEADER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9283 bmih.cx = (SHORT)width;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9284 bmih.cy = (SHORT)height;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9285 bmih.cPlanes = (SHORT)cPlanes;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9286 bmih.cBitCount = (SHORT)depth;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9287
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9288 pixmap->width = width; pixmap->height = height;
962
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9289 pixmap->transcolor = DW_CLR_DEFAULT;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9290
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9291 pixmap->hbm = GpiCreateBitmap(pixmap->hps, (PBITMAPINFOHEADER2)&bmih, 0L, NULL, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9292
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9293 GpiSetBitmap(pixmap->hps, pixmap->hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9294
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9295 if (depth>8)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9296 GpiCreateLogColorTable(pixmap->hps, LCOL_PURECOLOR, LCOLF_RGB, 0, 0, NULL );
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9297
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9298 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9299
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9300 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9301 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9302
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9303 /*
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9304 * Creates a pixmap from a file.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9305 * Parameters:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9306 * 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
9307 * 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
9308 * DW pick the appropriate file extension.
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9309 * (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
9310 * Returns:
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9311 * 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
9312 */
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9313 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
9314 {
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9315 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9316 char *file = alloca(strlen(filename) + 5);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9317
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9318 if ( !file || !(pixmap = calloc(1,sizeof(struct _hpixmap))) )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9319 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9320
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9321 strcpy(file, filename);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9322
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9323 /* check if we can read from this file (it exists and read permission) */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9324 if ( access(file, 04) != 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9325 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9326 /* Try with .bmp extention */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9327 strcat(file, ".bmp");
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9328 if ( access(file, 04) != 0 )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9329 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9330 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9331 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9332 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9333 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9334
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9335 /* Try to load the bitmap from file */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9336 if ( !_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height) )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9337 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9338 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9339 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9340 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9341
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9342 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9343 pixmap->handle = handle;
962
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9344 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9345
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9346 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9347 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9348
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9349 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9350 * Creates a pixmap from memory.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9351 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9352 * handle: Window handle the pixmap is associated with.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9353 * data: Source of the image data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9354 * (BMP on OS/2 or Windows, XPM on Unix)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9355 * le: length of data
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9356 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9357 * A handle to a pixmap or NULL on failure.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9358 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9359 HPIXMAP API dw_pixmap_new_from_data(HWND handle, char *data, int len)
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9360 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9361 HPIXMAP pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9362 char *file;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9363 FILE *fp;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9364
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9365 if ( !(pixmap = calloc(1,sizeof(struct _hpixmap))) )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9366 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9367
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9368 file = tmpnam( NULL );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9369 if ( file != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9370 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9371 fp = fopen( file, "wb" );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9372 if ( fp != NULL )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9373 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9374 fwrite( data, 1, len, fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9375 fclose( fp );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9376 if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9377 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9378 /* Try to load the bitmap from file */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9379 if ( !_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height) )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9380 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9381 free(pixmap);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9382 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9383 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9384 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9385 else /* otherwise its assumed to be an ico */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9386 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9387 /* con't use ICO ? */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9388 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9389 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9390 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9391 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9392 else
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9393 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9394 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9395 return NULL;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9396 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9397 unlink( file );
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9398 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9399
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9400 /* Success fill in other values */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9401 pixmap->handle = handle;
962
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9402 pixmap->transcolor = DW_CLR_DEFAULT;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9403
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9404 return pixmap;
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9405 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9406
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9407 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9408 * Creates a bitmap mask for rendering bitmaps with transparent backgrounds
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9409 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9410 void API dw_pixmap_set_transparent_color( HPIXMAP pixmap, ULONG color )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9411 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9412 if ( pixmap )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9413 {
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9414 pixmap->transcolor = _internal_color(color);
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
9415 }
241
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9416 }
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9417
00d2b1bcf036 Added dw_pixmap_new_from_file().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 236
diff changeset
9418 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9419 * Creates a pixmap from internal resource graphic specified by id.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9420 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9421 * handle: Window handle the pixmap is associated with.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9422 * id: Resource ID associated with requested pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9423 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9424 * A handle to a pixmap or NULL on failure.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9425 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9426 HPIXMAP API dw_pixmap_grab(HWND handle, ULONG id)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9427 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9428 BITMAPINFOHEADER bmih;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9429 SIZEL sizl = { 0, 0 };
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9430 HPIXMAP pixmap;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9431 HDC hdc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9432 HPS hps;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9433 ULONG ulFlags;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9434
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9435 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9436 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9437
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9438 hps = WinGetPS(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9439
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9440 hdc = GpiQueryDevice(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9441 ulFlags = GpiQueryPS(hps, &sizl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9442
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9443 pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, (PSZ)"*", 0L, NULL, hdc);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9444 pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9445
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9446 pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9447
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9448 GpiQueryBitmapParameters(pixmap->hbm, &bmih);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9449
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9450 GpiSetBitmap(pixmap->hps, pixmap->hbm);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9451
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9452 pixmap->width = bmih.cx; pixmap->height = bmih.cy;
962
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9453 pixmap->transcolor = DW_CLR_DEFAULT;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9454
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9455 WinReleasePS(hps);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9456
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9457 return pixmap;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9458 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9459
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9460 /*
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9461 * Sets the font used by a specified pixmap.
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9462 * Normally the pixmap font is obtained from the associated window handle.
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9463 * However this can be used to override that, or for pixmaps with no window.
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9464 * Parameters:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9465 * pixmap: Handle to a pixmap returned by dw_pixmap_new() or
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9466 * passed to the application via a callback.
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9467 * fontname: Name and size of the font in the form "size.fontname"
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9468 * Returns:
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9469 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9470 */
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9471 int API dw_pixmap_set_font(HPIXMAP pixmap, char *fontname)
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9472 {
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9473 if(pixmap && fontname && *fontname)
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9474 {
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9475 if(!pixmap->font)
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9476 pixmap->font = WinCreateWindow(HWND_OBJECT, WC_FRAME, NULL, 0,0,0,1,1, NULLHANDLE, HWND_TOP,0, NULL, NULL);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9477 WinSetPresParam(pixmap->font, PP_FONTNAMESIZE, strlen(fontname)+1, fontname);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9478 return DW_ERROR_NONE;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
9479 }
1150
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9480 return DW_ERROR_GENERAL;
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9481 }
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9482
0c073534d722 Implemented OS/2 dw_pixmap_set_font() this will need more work...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1137
diff changeset
9483 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9484 * Destroys an allocated pixmap.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9485 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9486 * pixmap: Handle to a pixmap returned by
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9487 * dw_pixmap_new..
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9488 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9489 void API dw_pixmap_destroy(HPIXMAP pixmap)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9490 {
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9491 if(pixmap->font)
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9492 WinDestroyWindow(pixmap->font);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9493 GpiSetBitmap(pixmap->hps, NULLHANDLE);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9494 GpiDeleteBitmap(pixmap->hbm);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9495 GpiAssociate(pixmap->hps, NULLHANDLE);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9496 GpiDestroyPS(pixmap->hps);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9497 DevCloseDC(pixmap->hdc);
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
9498 free(pixmap);
3
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 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9502 * Copies from one item to another.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9503 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9504 * dest: Destination window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9505 * destp: Destination pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9506 * xdest: X coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9507 * ydest: Y coordinate of destination.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9508 * width: Width of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9509 * height: Height of area to copy.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9510 * src: Source window handle.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9511 * srcp: Source pixmap. (choose only one).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9512 * xsrc: X coordinate of source.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9513 * ysrc: Y coordinate of source.
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_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
9516 {
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9517 dw_pixmap_stretch_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, -1, -1);
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9518 }
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9519
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9520 /*
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9521 * Copies from one surface to another allowing for stretching.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9522 * Parameters:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9523 * dest: Destination window handle.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9524 * destp: Destination pixmap. (choose only one).
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9525 * xdest: X coordinate of destination.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9526 * ydest: Y coordinate of destination.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9527 * width: Width of the target area.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9528 * height: Height of the target area.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9529 * src: Source window handle.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9530 * srcp: Source pixmap. (choose only one).
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9531 * xsrc: X coordinate of source.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9532 * ysrc: Y coordinate of source.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9533 * srcwidth: Width of area to copy.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9534 * srcheight: Height of area to copy.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9535 * Returns:
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9536 * DW_ERROR_NONE on success and DW_ERROR_GENERAL on failure.
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9537 */
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9538 int API dw_pixmap_stretch_bitblt(HWND dest, HPIXMAP destp, int xdest, int ydest, int width, int height, HWND src, HPIXMAP srcp, int xsrc, int ysrc, int srcwidth, int srcheight)
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9539 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9540 HPS hpsdest;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9541 HPS hpssrc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9542 POINTL ptl[4];
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9543 int dheight, sheight;
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9544 int count = 3;
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9545
1244
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9546 /* Do some sanity checks */
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9547 if((srcheight == -1 || srcwidth == -1) && srcheight != srcwidth)
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9548 return DW_ERROR_GENERAL;
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9549
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9550 if(dest)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9551 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9552 hpsdest = WinGetPS(dest);
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9553 dheight = _get_height(dest);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9554 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9555 else if(destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9556 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9557 hpsdest = destp->hps;
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9558 dheight = destp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9559 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9560 else
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9561 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9562
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9563 if(src)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9564 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9565 hpssrc = WinGetPS(src);
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9566 sheight = _get_height(src);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9567 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9568 else if(srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9569 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9570 hpssrc = srcp->hps;
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9571 sheight = srcp->height;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9572 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9573 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9574 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9575 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9576 WinReleasePS(hpsdest);
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9577 return DW_ERROR_GENERAL;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9578 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9579
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9580 ptl[0].x = xdest;
1244
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9581 ptl[0].y = dheight - (ydest + height);
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9582 ptl[1].x = xdest + width;
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9583 ptl[1].y = dheight - ydest;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9584 ptl[2].x = xsrc;
1244
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9585 ptl[2].y = sheight - (ysrc + (srcheight != -1 ? srcheight : height));
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9586 if(srcwidth != -1 && srcheight != -1)
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9587 {
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9588 count = 4;
1244
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9589 ptl[3].x = xsrc + srcwidth;
db26b9622769 Fixed dw_pixmap_stretch_bitblt() on OS/2. Also cleaned up the code...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1243
diff changeset
9590 ptl[3].y = sheight - ysrc;
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9591 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9592
962
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9593 /* Handle transparency if requested */
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9594 if(srcp && srcp->transcolor != DW_CLR_DEFAULT)
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9595 {
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9596 IMAGEBUNDLE newIb, oldIb;
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9597 /* Transparent color is put into the background color */
963
ea356c38f7b6 Fixed a coordinate system issue with the button press handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 962
diff changeset
9598 GpiSetBackColor(hpsdest, srcp->transcolor);
ea356c38f7b6 Fixed a coordinate system issue with the button press handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 962
diff changeset
9599 GpiQueryAttrs(hpsdest, PRIM_IMAGE, IBB_BACK_MIX_MODE, (PBUNDLE)&oldIb);
ea356c38f7b6 Fixed a coordinate system issue with the button press handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 962
diff changeset
9600 newIb.usBackMixMode = BM_SRCTRANSPARENT;
ea356c38f7b6 Fixed a coordinate system issue with the button press handler on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 962
diff changeset
9601 GpiSetAttrs(hpsdest, PRIM_IMAGE, IBB_BACK_MIX_MODE, 0, (PBUNDLE)&newIb);
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9602 GpiBitBlt(hpsdest, hpssrc, count, ptl, ROP_SRCCOPY, BBO_IGNORE);
962
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9603 GpiSetAttrs(hpsdest, PRIM_IMAGE, IBB_BACK_MIX_MODE, 0, (PBUNDLE)&oldIb);
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9604 }
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9605 else
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9606 {
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9607 /* Otherwise use the regular BitBlt call */
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9608 GpiBitBlt(hpsdest, hpssrc, count, ptl, ROP_SRCCOPY, BBO_IGNORE);
962
e3425875a03a Implemented transparent BitBlt on OS/2 using dw_pixmap_set_transparent_color() like on Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 956
diff changeset
9609 }
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9610
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9611 if(!destp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9612 WinReleasePS(hpsdest);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9613 if(!srcp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9614 WinReleasePS(hpssrc);
1243
c191a562c14a Added new dw_pixmap_stretch_bitblt() function on Windows and OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1233
diff changeset
9615 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9616 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9617
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
9618 /* 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
9619 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
9620 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9621 int *info = (int *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9622
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9623 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9624 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9625 DosBeep(info[0], info[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9626 free(data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9627 }
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
9628 }
e0ea29c3d1eb Fixed dw_window_pointer() so it works on Windows. Tried to fix the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 526
diff changeset
9629
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9630 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9631 * Emits a beep.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9632 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9633 * freq: Frequency.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9634 * dur: Duration.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9635 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9636 void API dw_beep(int freq, int dur)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9637 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9638 int *info = malloc(sizeof(int) * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9639
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9640 if(info)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9641 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9642 info[0] = freq;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9643 info[1] = dur;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9644
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9645 _beginthread(_beepthread, NULL, 100, (void *)info);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9646 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9647 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9648
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9649 /* Open a shared library and return a handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9650 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9651 * name: Base name of the shared library.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9652 * handle: Pointer to a module handle,
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9653 * will be filled in with the handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9654 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9655 int API dw_module_load(char *name, HMOD *handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9656 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9657 char objnamebuf[300] = "";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9658
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9659 return DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)name, handle);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9660 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9661
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9662 /* Queries the address of a symbol within open handle.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9663 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9664 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9665 * name: Name of the symbol you want the address of.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9666 * func: A pointer to a function pointer, to obtain
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9667 * the address.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9668 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9669 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
9670 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9671 return DosQueryProcAddr(handle, 0, (PSZ)name, (PFN*)func);
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9672 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9673
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9674 /* Frees the shared library previously opened.
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9675 * Parameters:
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9676 * handle: Module handle returned by dw_module_load()
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9677 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9678 int API dw_module_close(HMOD handle)
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9679 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9680 DosFreeModule(handle);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9681 return 0;
157
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9682 }
a07dd2e819f3 Added module support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 156
diff changeset
9683
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9684 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9685 * Returns the handle to an unnamed mutex semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9686 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9687 HMTX API dw_mutex_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9688 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9689 HMTX mutex;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9690
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9691 DosCreateMutexSem(NULL, &mutex, 0, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9692 return mutex;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9693 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9694
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9695 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9696 * Closes a semaphore created by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9697 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9698 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9699 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9700 void API dw_mutex_close(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9701 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9702 DosCloseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9703 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9704
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9705 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9706 * 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
9707 * 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
9708 * while blocking.
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9709 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9710 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9711 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9712 void API dw_mutex_lock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9713 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9714 if(_dwtid == dw_thread_id())
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9715 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9716 int rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9717
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9718 while(rc == ERROR_TIMEOUT)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9719 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9720 dw_main_sleep(10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9721 rc = DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9722 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9723 }
63
a6801a2260af Synched up with the latest dynamic windows, has new slider support and
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 62
diff changeset
9724 else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9725 DosRequestMutexSem(mutex, SEM_INDEFINITE_WAIT);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9726 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9727
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9728 /*
1158
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9729 * Tries to gain access to the semaphore.
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9730 * Parameters:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9731 * mutex: The handle to the mutex returned by dw_mutex_new().
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9732 * Returns:
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9733 * DW_ERROR_NONE on success, DW_ERROR_TIMEOUT if it is already locked.
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9734 */
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9735 int API dw_mutex_trylock(HMTX mutex)
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9736 {
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9737 if(DosRequestMutexSem(mutex, SEM_IMMEDIATE_RETURN) == NO_ERROR)
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9738 return DW_ERROR_NONE;
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9739 return DW_ERROR_TIMEOUT;
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9740 }
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9741
f86f556ff29d Added dw_mutex_trylock() that functions like dw_mutex_lock() except
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1152
diff changeset
9742 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9743 * Reliquishes the access to the semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9744 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9745 * mutex: The handle to the mutex returned by dw_mutex_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9746 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9747 void API dw_mutex_unlock(HMTX mutex)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9748 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9749 DosReleaseMutexSem(mutex);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9750 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9751
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9752 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9753 * Returns the handle to an unnamed event semaphore.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9754 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9755 HEV API dw_event_new(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9756 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9757 HEV blah;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9758
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9759 if(DosCreateEventSem (NULL, &blah, 0L, FALSE))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9760 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9761
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9762 return blah;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9763 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9764
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9765 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9766 * Resets a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9767 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9768 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9769 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9770 int API dw_event_reset(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9771 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9772 ULONG count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9773
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9774 if(DosResetEventSem(eve, &count))
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9775 return DW_ERROR_GENERAL;
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9776 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9777 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9778
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9779 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9780 * Posts a semaphore created by dw_event_new(). Causing all threads
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9781 * waiting on this event in dw_event_wait to continue.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9782 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9783 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9784 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9785 int API dw_event_post(HEV eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9786 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9787 if(DosPostEventSem(eve))
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9788 return DW_ERROR_GENERAL;
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9789 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9790 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9791
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9792
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9793 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9794 * Waits on a semaphore created by dw_event_new(), until the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9795 * event gets posted or until the timeout expires.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9796 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9797 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9798 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9799 int API dw_event_wait(HEV eve, unsigned long timeout)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9800 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9801 int rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9802 if(!rc)
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9803 return DW_ERROR_NONE;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9804 if(rc == ERROR_TIMEOUT)
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9805 return DW_ERROR_TIMEOUT;
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9806 return DW_ERROR_GENERAL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9807 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9808
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9809 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9810 * Closes a semaphore created by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9811 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9812 * eve: The handle to the event returned by dw_event_new().
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9813 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
9814 int API dw_event_close(HEV *eve)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9815 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9816 if(!eve || ~DosCloseEventSem(*eve))
986
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9817 return DW_ERROR_GENERAL;
87dc0f5f96d0 Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 965
diff changeset
9818 return DW_ERROR_NONE;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9819 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
9820
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
9821 /* 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
9822 * 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
9823 * 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
9824 * 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
9825 * 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
9826 * 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
9827 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9828 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
9829 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9830 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9831 HEV ev = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9832
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9833 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9834 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9835
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9836 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9837 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9838
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9839 DosCreateEventSem((PSZ)semname, &ev, 0L, FALSE);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9840
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9841 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9842 return ev;
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
9843 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9844
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9845 /* 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
9846 * 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
9847 * 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
9848 * 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
9849 * 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
9850 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9851 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
9852 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9853 char *semname = malloc(strlen(name)+8);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9854 HEV ev;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9855
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9856 if(!semname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9857 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9858
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9859 strcpy(semname, "\\sem32\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9860 strcat(semname, name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9861
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9862 DosOpenEventSem((PSZ)semname, &ev);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9863
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9864 free(semname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9865 return ev;
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
9866 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9867
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9868 /* 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
9869 * 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
9870 * 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
9871 * 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
9872 * 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
9873 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9874 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
9875 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9876 ULONG count;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9877
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9878 return DosResetEventSem(eve, &count);
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
9879 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9880
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9881 /* 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
9882 * 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
9883 * 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
9884 * 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
9885 * 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
9886 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9887 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
9888 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9889 return DosPostEventSem(eve);
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
9890 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9891
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9892
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9893 /* 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
9894 * 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
9895 * 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
9896 * 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
9897 * 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
9898 * 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
9899 * 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
9900 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9901 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
9902 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9903 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9904
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9905 rc = DosWaitEventSem(eve, timeout);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9906 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9907 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9908 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9909 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9910 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9911 case ERROR_NOT_ENOUGH_MEMORY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9912 rc = DW_ERROR_NO_MEM;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9913 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9914 case ERROR_INTERRUPT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9915 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9916 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9917 case ERROR_TIMEOUT:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9918 rc = DW_ERROR_TIMEOUT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9919 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9920 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9921
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9922 return rc;
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
9923 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9924
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9925 /* 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
9926 * 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
9927 * 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
9928 * 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
9929 * 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
9930 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9931 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
9932 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9933 int rc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9934
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9935 rc = DosCloseEventSem(eve);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9936 switch (rc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9937 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9938 case ERROR_INVALID_HANDLE:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9939 rc = DW_ERROR_NON_INIT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9940 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9941
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9942 case ERROR_SEM_BUSY:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9943 rc = DW_ERROR_INTERRUPT;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9944 break;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9945 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9946
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9947 return rc;
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
9948 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9949
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9950 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9951 * 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
9952 * 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
9953 * 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
9954 * 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
9955 * 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
9956 * 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
9957 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
9958 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
9959 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9960 char namebuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9961
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9962 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9963
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9964 if(DosAllocSharedMem((void *)dest, (PSZ)namebuf, size, PAG_COMMIT | PAG_WRITE | PAG_READ) != NO_ERROR)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9965 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9966
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9967 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
9968 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9969
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9970 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9971 * 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
9972 * 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
9973 * 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
9974 * 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
9975 * 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
9976 */
559
841445b0b457 Fixes for the shared memory and named semaphore code.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 557
diff changeset
9977 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
9978 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9979 char namebuf[1024];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9980
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9981 size = size;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9982 sprintf(namebuf, "\\sharemem\\%s", name);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9983
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
9984 if(DosGetNamedSharedMem((void *)dest, (PSZ)namebuf, PAG_READ | PAG_WRITE) != NO_ERROR)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9985 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9986
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9987 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
9988 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9989
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9990 /*
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9991 * 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
9992 * 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
9993 * 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
9994 * 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
9995 */
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
9996 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
9997 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9998 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
9999
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10000 if(DosFreeMem(ptr) != NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10001 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10002 return 0;
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
10003 }
1a210e2f214b Added a bunch of support routines I now own due to the settlement
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 554
diff changeset
10004
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10005 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10006 * Encapsulate the message queues on OS/2.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10007 */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10008 void _dwthreadstart(void *data)
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10009 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10010 HAB thishab = WinInitialize(0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10011 HMQ thishmq = WinCreateMsgQueue(dwhab, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10012 void (* API threadfunc)(void *) = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10013 void **tmp = (void **)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10014
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10015 threadfunc = (void (* API)(void *))tmp[0];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10016 threadfunc(tmp[1]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10017
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10018 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10019
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10020 WinDestroyMsgQueue(thishmq);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10021 WinTerminate(thishab);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10022 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10023
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10024 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10025 * Creates a new thread with a starting point of func.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10026 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10027 * func: Function which will be run in the new thread.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10028 * data: Parameter(s) passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10029 * stack: Stack size of new thread (OS/2 and Windows only).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10030 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10031 DWTID API dw_thread_new(void *func, void *data, int stack)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10032 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10033 void **tmp = malloc(sizeof(void *) * 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10034
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10035 tmp[0] = func;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10036 tmp[1] = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10037
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10038 return (DWTID)_beginthread((void (*)(void *))_dwthreadstart, NULL, stack, (void *)tmp);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10039 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10040
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10041 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10042 * Ends execution of current thread immediately.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10043 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10044 void API dw_thread_end(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10045 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10046 _endthread();
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10047 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10048
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10049 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10050 * Returns the current thread's ID.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10051 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10052 DWTID API dw_thread_id(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10053 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10054 return (DWTID)_threadid;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10055 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10056
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10057 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10058 * Cleanly terminates a DW session, should be signal handler safe.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10059 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10060 * exitcode: Exit code reported to the operating system.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10061 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10062 void API dw_exit(int exitcode)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10063 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10064 /* Destroy the menu message window */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10065 dw_window_destroy(hwndApp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10066
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10067 /* In case we are in a signal handler, don't
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10068 * try to free memory that could possibly be
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10069 * free()'d by the runtime already.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10070 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10071 Root = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10072
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10073 DosFreeModule(wpconfig);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10074 exit(exitcode);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10075 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10076
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10077 /*
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
10078 * 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
10079 * 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
10080 * 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
10081 * 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
10082 * 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
10083 * 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
10084 * 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
10085 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10086 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
10087 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10088 HWND tmp = WinCreateWindow(HWND_OBJECT,
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10089 (PSZ)SplitbarClassName,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10090 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10091 WS_VISIBLE | WS_CLIPCHILDREN,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10092 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10093 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10094 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10095 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10096 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10097 NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10098 if(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10099 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10100 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
10101 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
10102
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10103 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10104 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10105 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10106
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10107 tmpbox = dw_box_new(DW_VERT, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10108 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10109 WinSetParent(tmpbox, tmp, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10110 *percent = 50.0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10111 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10112 dw_window_set_data(tmp, "_dw_percent", (void *)percent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10113 dw_window_set_data(tmp, "_dw_type", (void *)type);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10114 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10115 return tmp;
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
10116 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10117
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10118 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10119 * 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
10120 * 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
10121 * 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
10122 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10123 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
10124 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10125 float *mypercent = (float *)dw_window_get_data(handle, "_dw_percent");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10126 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
10127 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
10128
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10129 if(mypercent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10130 *mypercent = percent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10131
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10132 dw_window_get_pos_size(handle, NULL, NULL, &width, &height);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10133
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10134 _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
10135 }
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10136
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10137 /*
d785ee5adf02 Initial rewrite of the splitbar code on OS/2. Actually moving of the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 116
diff changeset
10138 * 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
10139 * 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
10140 * 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
10141 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10142 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
10143 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10144 float *percent = (float *)dw_window_get_data(handle, "_dw_percent");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10145
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10146 if(percent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10147 return *percent;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10148 return 0.0;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10149 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10150
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10151 /* The following two functions graciously contributed by Peter Nielsen. */
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10152 static ULONG _ParseBuildLevel (char* pchBuffer, ULONG ulSize) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10153 char* pchStart = pchBuffer;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10154 char* pchEnd = pchStart + ulSize - 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10155
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10156 while (pchEnd >= pchStart)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10157 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10158 if ((pchEnd[0] == '#') && (pchEnd[1] == '@'))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10159 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10160 *pchEnd-- = '\0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10161 while (pchEnd >= pchStart)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10162 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10163 if ((pchEnd[0] == '@') && (pchEnd[1] == '#'))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10164 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10165 ULONG ulMajor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10166 ULONG ulMinor = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10167
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10168 char* pch = pchEnd + 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10169 while (!isdigit ((int)*pch) && *pch)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10170 pch++;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10171
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10172 while (isdigit ((int)*pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10173 ulMajor = ulMajor * 10 + *pch++ - '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10174
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10175 if (*pch == '.')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10176 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10177 while (isdigit ((int)*++pch))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10178 ulMinor = ulMinor * 10 + *pch - '0';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10179 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10180 return ((ulMajor << 16) | ulMinor);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10181 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10182 pchEnd--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10183 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10184 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10185 pchEnd--;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10186 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10187 return (0);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10188 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10189
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10190 ULONG _GetSystemBuildLevel(void) {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10191 /* 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.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10192 * 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.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10193 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10194 ULONG ulBootDrive = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10195 ULONG ulBuild = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10196 if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10197 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10198 char achFileName[11] = "C:\\OS2KRNL";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10199 HFILE hfile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10200 ULONG ulResult;
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10201
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10202 achFileName[0] = (char)('A'+ulBootDrive-1);
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10203
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10204 if (DosOpen ((PSZ)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)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10205 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10206 ULONG ulFileSize = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10207 if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10208 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10209 const ULONG ulFirstTry = min (256, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10210 if (DosSetFilePtr (hfile, -(LONG)ulFirstTry, FILE_END, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10211 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10212 char *pchBuffer = malloc(ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10213 if (DosRead (hfile, pchBuffer, ulFirstTry, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10214 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10215 ulBuild = _ParseBuildLevel (pchBuffer, ulFirstTry);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10216 if (ulBuild == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10217 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10218 if (DosSetFilePtr (hfile, 0, FILE_BEGIN, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10219 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10220 free(pchBuffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10221 pchBuffer = malloc(ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10222
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10223 if (DosRead (hfile, pchBuffer, ulFileSize, &ulResult) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10224 ulBuild = _ParseBuildLevel (pchBuffer, ulFileSize);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10225 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10226 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10227 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10228 free(pchBuffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10229 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10230 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10231 DosClose (hfile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10232 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10233 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10234 return (ulBuild);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10235 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10236
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
10237 /*
b03b24bb95f8 Added dw_window_default() to set the default focus widget in a dialog.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 33
diff changeset
10238 * 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
10239 * 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
10240 * 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
10241 * 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
10242 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10243 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
10244 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10245 Box *thisbox = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10246 HWND box;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10247
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10248 box = WinWindowFromID(window, FID_CLIENT);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10249 if(box)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10250 thisbox = WinQueryWindowPtr(box, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10251
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10252 if(thisbox)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10253 thisbox->defaultitem = 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
10254 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10255
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10256 /*
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10257 * 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
10258 * Parameters:
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10259 * 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
10260 * 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
10261 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10262 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
10263 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10264 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10265
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10266 if(blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10267 blah->clickdefault = next;
40
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10268 }
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10269
88c9c7410c22 Lots of fixes and new functions on all platforms.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 39
diff changeset
10270 /*
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10271 * Gets the contents of the default clipboard as text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10272 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10273 * None.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10274 * Returns:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10275 * Pointer to an allocated string of text or NULL if clipboard empty or contents could not
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10276 * be converted to text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10277 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10278 char *dw_clipboard_get_text()
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10279 {
823
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10280 APIRET rc;
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10281 char *retbuf = NULL;
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10282 ULONG fmtInfo;
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10283
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10284 WinOpenClipbrd(dwhab);
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10285
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10286 rc = WinQueryClipbrdFmtInfo(dwhab, CF_TEXT, &fmtInfo);
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10287 if (rc) /* Text data in clipboard */
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10288 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10289 PSZ pszClipText = (PSZ)WinQueryClipbrdData(dwhab, CF_TEXT); /* Query data handle */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10290 retbuf = strdup((char *)pszClipText);
823
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10291 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10292 WinCloseClipbrd(dwhab);
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10293 return retbuf;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10294 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10295
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10296 /*
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10297 * Sets the contents of the default clipboard to the supplied text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10298 * Parameters:
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10299 * Text.
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10300 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10301 void dw_clipboard_set_text( char *str, int len )
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10302 {
823
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10303 APIRET rc;
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10304 static PVOID shared;
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10305
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10306 WinOpenClipbrd(dwhab); /* Open clipboard */
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10307 WinEmptyClipbrd(dwhab); /* Empty clipboard */
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10308
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10309 /* Ok, clipboard wants giveable unnamed shared memory */
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10310
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10311 shared = NULL;
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10312 rc = DosAllocSharedMem(&shared, NULL, len, OBJ_GIVEABLE | PAG_COMMIT | PAG_READ | PAG_WRITE);
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10313
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10314 if (rc == 0)
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10315 {
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10316 memcpy(shared, str, len);
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10317
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10318 WinSetClipbrdData(dwhab, (ULONG)shared, CF_TEXT, CFI_POINTER);
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10319 }
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10320
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
10321 WinCloseClipbrd(dwhab); /* Close clipboard */
822
eaaef18d5b21 Fix various compiler warnings on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 819
diff changeset
10322 return;
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10323 }
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10324
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
10325 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10326 * Returns some information about the current operating environment.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10327 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10328 * env: Pointer to a DWEnv struct.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10329 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10330 void API dw_environment_query(DWEnv *env)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10331 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10332 ULONG Build;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10333
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10334 if(!env)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10335 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10336
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10337 /* The default is OS/2 2.0 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10338 strcpy(env->osName,"OS/2");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10339 env->MajorVersion = 2;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10340 env->MinorVersion = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10341
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10342 Build = _GetSystemBuildLevel();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10343 env->MinorBuild = Build & 0xFFFF;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10344 env->MajorBuild = Build >> 16;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10345
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10346 if (aulBuffer[0] == 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10347 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10348 int i = (unsigned int)aulBuffer[1];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10349 if (i > 20)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10350 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10351 strcpy(env->osName,"Warp");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10352 env->MajorVersion = (int)i/10;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10353 env->MinorVersion = i-(((int)i/10)*10);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10354 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10355 else if (i == 10)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10356 env->MinorVersion = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10357 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10358 strcpy(env->buildDate, __DATE__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10359 strcpy(env->buildTime, __TIME__);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10360 env->DWMajorVersion = DW_MAJOR_VERSION;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10361 env->DWMinorVersion = DW_MINOR_VERSION;
1160
924c8087a755 Attempt to use the subversion revision number as the sub version number.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1158
diff changeset
10362 #ifdef VER_REV
924c8087a755 Attempt to use the subversion revision number as the sub version number.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1158
diff changeset
10363 env->DWSubVersion = VER_REV;
924c8087a755 Attempt to use the subversion revision number as the sub version number.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1158
diff changeset
10364 #else
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10365 env->DWSubVersion = DW_SUB_VERSION;
1160
924c8087a755 Attempt to use the subversion revision number as the sub version number.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1158
diff changeset
10366 #endif
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10367 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10368
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10369 /* 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
10370 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
10371 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10372 FILEFINDBUF3 ffbuf;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10373 HTREEITEM item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10374 ULONG count = 1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10375 HDIR hdir = HDIR_CREATE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10376
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10377 if(DosFindFirst((PSZ)path, &hdir, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED | MUST_HAVE_DIRECTORY,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10378 &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10379 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10380 while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10381 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10382 if(strcmp(ffbuf.achName, ".") && strcmp(ffbuf.achName, ".."))
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10383 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10384 int len = strlen(path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10385 char *folder = malloc(len + ffbuf.cchName + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10386 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10387
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10388 strcpy(folder, path);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10389 strcpy(&folder[len-1], ffbuf.achName);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10390
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10391 item = dw_tree_insert(tree, ffbuf.achName, WinLoadFileIcon((PSZ)folder, TRUE), parent, (void *)parent);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10392 tempitem = dw_tree_insert(tree, "", 0, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10393 dw_tree_item_set_data(tree, item, (void *)tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10394 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10395 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10396 DosFindClose(hdir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10397 }
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10398 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10399
906
71b0e132d9df Added missing API to _popuplate_tree_thread() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 904
diff changeset
10400 void API _populate_tree_thread(void *data)
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10401 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10402 HWND window = (HWND)data, tree = (HWND)dw_window_get_data(window, "_dw_tree");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10403 HMTX mtx = (HMTX)dw_window_get_data(window, "_dw_mutex");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10404 int drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10405 HTREEITEM items[26];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10406 FSINFO volinfo;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10407
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10408 DosError(FERR_DISABLEHARDERR);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10409
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10410 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10411 for(drive=0;drive<26;drive++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10412 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10413 if(DosQueryFSInfo(drive+1, FSIL_VOLSER,(PVOID)&volinfo, sizeof(FSINFO)) == NO_ERROR)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10414 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10415 char folder[5] = "C:\\", name[9] = "Drive C:";
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10416 HTREEITEM tempitem;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10417
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10418 folder[0] = name[6] = 'A' + drive;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10419
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10420 items[drive] = dw_tree_insert(tree, name, WinLoadFileIcon((PSZ)folder, TRUE), NULL, 0);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10421 tempitem = dw_tree_insert(tree, "", 0, items[drive], 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10422 dw_tree_item_set_data(tree, items[drive], (void *)tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10423 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10424 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10425 items[drive] = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10426 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10427 dw_mutex_unlock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10428
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10429 DosError(FERR_ENABLEHARDERR);
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10430 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10431
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10432 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
10433 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10434 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10435 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10436 void *treedata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10437
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10438 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10439 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10440 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10441
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10442 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10443 treedata = dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10444 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10445 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10446 dw_dialog_dismiss((DWDialog *)data, treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10447 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10448 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10449
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10450 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
10451 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10452 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10453 HMTX mtx = (HMTX)dw_window_get_data((HWND)dwwait->data, "_dw_mutex");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10454
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10455 window = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10456 if(!dwwait)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10457 return FALSE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10458
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10459 dw_mutex_lock(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10460 dw_mutex_close(mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10461 dw_window_destroy((HWND)dwwait->data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10462 dw_dialog_dismiss((DWDialog *)data, NULL);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10463 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10464 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10465
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
10466 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
10467 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10468 char *folder=strdup("");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10469 HTREEITEM parent = item;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10470
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10471 while(parent)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10472 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10473 char *temp, *text = dw_tree_get_title(tree, parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10474
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10475 if(text)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10476 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10477 if(strncmp(text, "Drive ", 6) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10478 text = &text[6];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10479
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10480 temp = malloc(strlen(text) + strlen(folder) + 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10481 strcpy(temp, text);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10482 strcat(temp, "\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10483 strcat(temp, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10484 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10485 folder = temp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10486 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10487 parent = dw_tree_get_parent(tree, parent);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10488 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10489 return 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
10490 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
10491
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10492 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
10493 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10494 DWDialog *dwwait = (DWDialog *)data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10495 char *treedata = (char *)dw_window_get_data((HWND)dwwait->data, "_dw_tree_selected");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10496
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10497 text = text; itemdata = itemdata;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10498 if(treedata)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10499 free(treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10500
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10501 treedata = _tree_folder(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10502 dw_window_set_data((HWND)dwwait->data, "_dw_tree_selected", (void *)treedata);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10503
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10504 return FALSE;
476
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10505 }
a84ee39e7aea Initial folder browser code for OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 475
diff changeset
10506
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
10507 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
10508 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10509 HTREEITEM tempitem = (HTREEITEM)dw_tree_item_get_data(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10510
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10511 data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10512 if(tempitem)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10513 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10514 char *folder = _tree_folder(window, item);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10515
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10516 dw_tree_item_set_data(window, item, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10517 dw_tree_item_delete(window, tempitem);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10518
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10519 if(*folder)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10520 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10521 strcat(folder, "*");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10522 _populate_directory(window, item, folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10523 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10524 free(folder);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10525 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10526
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10527 return FALSE;
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
10528 }
ea099ba917c6 Added two new tree functions, get_title and get_parent and finished the
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 477
diff changeset
10529
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10530 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10531 * Opens a file dialog and queries user selection.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10532 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10533 * title: Title bar text for dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10534 * defpath: The default path of the open dialog.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10535 * ext: Default file extention.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10536 * flags: DW_FILE_OPEN or DW_FILE_SAVE.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10537 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10538 * NULL on error. A malloced buffer containing
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10539 * the file path on success.
566
f6de197ecbe9 Add dw_color_choose()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 562
diff changeset
10540 *
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10541 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10542 char * API dw_file_browse(char *title, char *defpath, char *ext, int flags)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10543 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10544 if(flags == DW_DIRECTORY_OPEN)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10545 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10546 HWND window, hbox, vbox, tree, button;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10547 DWDialog *dwwait;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10548 HMTX mtx = dw_mutex_new();
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10549
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10550 window = dw_window_new( HWND_DESKTOP, title, FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10551
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10552 vbox = dw_box_new(DW_VERT, 5);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10553
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10554 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10555
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10556 tree = dw_tree_new(60);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10557
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10558 dw_box_pack_start(vbox, tree, 1, 1, TRUE, TRUE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10559 dw_window_set_data(window, "_dw_mutex", (void *)mtx);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10560 dw_window_set_data(window, "_dw_tree", (void *)tree);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10561
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10562 hbox = dw_box_new(DW_HORZ, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10563
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10564 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10565
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10566 dwwait = dw_dialog_new((void *)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10567
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10568 dw_signal_connect(tree, DW_SIGNAL_ITEM_SELECT, DW_SIGNAL_FUNC(_item_select), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10569 dw_signal_connect(tree, DW_SIGNAL_TREE_EXPAND, DW_SIGNAL_FUNC(_tree_expand), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10570
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10571 button = dw_button_new("Ok", 1001L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10572 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10573 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_ok_func), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10574
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10575 button = dw_button_new("Cancel", 1002L);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10576 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10577 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10578 dw_signal_connect(window, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10579
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10580 dw_window_set_size(window, 225, 300);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10581 dw_window_show(window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10582
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10583 dw_thread_new((void *)_populate_tree_thread, (void *)window, 0xff);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10584 return (char *)dw_dialog_wait(dwwait);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10585 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10586 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10587 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10588 FILEDLG fild = { 0 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10589 HWND hwndFile;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10590 int len;
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10591 struct stat buf;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10592
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10593 if(defpath)
1299
66d4e16349e0 Use DosQueryPathInfo() to get the full path of file/dir on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1291
diff changeset
10594 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10595 if(DosQueryPathInfo((PSZ)defpath, FIL_QUERYFULLNAME, fild.szFullFile, sizeof(fild.szFullFile)))
1299
66d4e16349e0 Use DosQueryPathInfo() to get the full path of file/dir on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1291
diff changeset
10596 strcpy(fild.szFullFile, defpath);
66d4e16349e0 Use DosQueryPathInfo() to get the full path of file/dir on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1291
diff changeset
10597 };
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10598
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10599 len = strlen(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10600
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10601 /* If we have a defpath */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10602 if(len)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10603 {
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10604 /* Check to see if it exists */
1299
66d4e16349e0 Use DosQueryPathInfo() to get the full path of file/dir on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1291
diff changeset
10605 if(stat(fild.szFullFile, &buf) == 0)
1278
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10606 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10607 /* If it is a directory... make sure there is a trailing \ */
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10608 if(buf.st_mode & S_IFDIR)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10609 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10610 if(fild.szFullFile[len-1] != '\\')
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10611 strcat(fild.szFullFile, "\\");
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10612 /* Set len to 0 so the wildcard gets added below */
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10613 len = 0;
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10614 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10615 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10616 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10617
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10618 /* If we need a wildcard (defpath isn't a file) */
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10619 if(!len)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10620 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10621 /* Add a * to get all files... */
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10622 strcat(fild.szFullFile, "*");
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10623
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10624 /* If an extension was requested... */
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10625 if(ext)
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10626 {
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10627 /* Limit the results further */
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10628 strcat(fild.szFullFile, ".");
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10629 strcat(fild.szFullFile, ext);
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10630 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10631 }
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10632
700dc6818431 Some code in dw_file_browse() seems to have gotten clobbered.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1276
diff changeset
10633 /* Setup the structure */
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10634 fild.cbSize = sizeof(FILEDLG);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10635 fild.fl = FDS_CENTER | FDS_OPEN_DIALOG;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10636 fild.pszTitle = (PSZ)title;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10637 fild.pszOKButton = (PSZ)((flags & DW_FILE_SAVE) ? "Save" : "Open");
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10638 fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10639
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10640 hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10641 if(hwndFile)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10642 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10643 switch(fild.lReturn)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10644 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10645 case DID_OK:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10646 return strdup(fild.szFullFile);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10647 case DID_CANCEL:
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10648 return NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10649 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10650 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10651 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10652 return NULL;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10653 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10654
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
10655 /* 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
10656 int _SetPath(char *path)
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
10657 {
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10658 #ifndef __WATCOMC__
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10659 if(strlen(path) > 2)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10660 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10661 if(path[1] == ':')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10662 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10663 char drive = toupper(path[0]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10664 _chdrive((drive - 'A')+1);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10665 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10666 }
172
0fc45e386376 Get Dynamic Windows building with Watcom.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 171
diff changeset
10667 #endif
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10668 return chdir(path);
170
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
10669 }
ee6858b7d1c3 Set DefaultWorkingDir before trying to start the web browser.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 169
diff changeset
10670
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10671 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10672 * Execute and external program in a seperate session.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10673 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10674 * program: Program name with optional path.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10675 * type: Either DW_EXEC_CON or DW_EXEC_GUI.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10676 * params: An array of pointers to string arguements.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10677 * Returns:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10678 * -1 on error.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10679 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10680 int API dw_exec(char *program, int type, char **params)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10681 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10682 type = type; /* keep compiler happy */
1364
417866ad960b Fixes for compiling with Watcom on OS/2...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1361
diff changeset
10683 return spawnvp(P_NOWAIT, program, (char * const *)params);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10684 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10685
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10686 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10687 * Loads a web browser pointed at the given URL.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10688 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10689 * url: Uniform resource locator.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10690 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
10691 int API dw_browse(char *url)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10692 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10693 char *execargs[3], browser[1024], *olddir, *newurl = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10694 int len, ret;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10695
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10696 olddir = _getcwd(NULL, 1024);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10697
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10698 PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS",
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10699 (PSZ)"DefaultWorkingDir", NULL, (PSZ)browser, 1024);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10700
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10701 if(browser[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10702 _SetPath(browser);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10703
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10704 PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS",
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10705 (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024);
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10706
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10707 len = strlen(browser) - strlen("explore.exe");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10708
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10709 execargs[0] = browser;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10710 execargs[1] = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10711 execargs[2] = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10712
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10713 /* Special case for Web Explorer, it requires file:/// instead
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10714 * of file:// so I am handling it here.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10715 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10716 if(len > 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10717 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10718 if(stricmp(&browser[len], "explore.exe") == 0 && stricmp(url, "file://") == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10719 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10720 int newlen, z;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10721 newurl = malloc(strlen(url) + 2);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10722 sprintf(newurl, "file:///%s", &url[7]);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10723 newlen = strlen(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10724 for(z=8;z<(newlen-8);z++)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10725 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10726 if(newurl[z] == '|')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10727 newurl[z] = ':';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10728 if(newurl[z] == '/')
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10729 newurl[z] = '\\';
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10730 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10731 execargs[1] = newurl;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10732 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10733 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10734
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10735 ret = dw_exec(browser, DW_EXEC_GUI, execargs);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10736
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10737 if(olddir)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10738 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10739 _SetPath(olddir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10740 free(olddir);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10741 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10742 if(newurl)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10743 free(newurl);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10744 return ret;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10745 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10746
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
10747 /*
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10748 * 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
10749 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10750 * 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
10751 * 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
10752 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10753 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
10754 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10755 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10756 action = action;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10757 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10758
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10759 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10760 * 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
10761 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10762 * 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
10763 * 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
10764 * be rendered.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10765 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10766 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10767 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10768 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
10769 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10770 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10771 string = string;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10772 return -1;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10773 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10774
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10775 /*
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10776 * 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
10777 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10778 * 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
10779 * 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
10780 * 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
10781 * Returns:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10782 * 0 on success.
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10783 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10784 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
10785 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10786 handle = handle;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10787 url = url;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10788 return -1;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10789 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10790
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10791 /*
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10792 * Create a new HTML window (widget) to be packed.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10793 * Not available under OS/2, eCS
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10794 * Parameters:
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10795 * 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
10796 * 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
10797 */
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10798 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
10799 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
10800 id = id;
1358
2f5e54b0c5c4 dw_debug() lines in dw_html_new() should end with a newline.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1357
diff changeset
10801 dw_debug("HTML widget not available; OS/2 currently does not support it.\n");
1354
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
10802 return 0;
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10803 }
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10804
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10805 typedef struct _dwprint
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10806 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10807 HDC hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10808 char *printername;
1183
0f85796c6988 Fix calling convention of print callback on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1182
diff changeset
10809 int (* API drawfunc)(HPRINT, HPIXMAP, int, void *);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10810 void *drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10811 unsigned long flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10812 unsigned int startpage, endpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10813 char *jobname;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10814 } DWPrint;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10815
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10816 /* Internal functions to handle the print dialog */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10817 int DWSIGNAL _dw_printer_cancel_func(HWND window, void *data)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10818 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10819 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10820 DWDialog *dwwait = (DWDialog *)print->printername;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10821
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10822 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10823
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10824 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10825 dw_dialog_dismiss(dwwait, NULL);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10826 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10827 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10828
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10829 int DWSIGNAL _dw_printer_ok_func(HWND window, void *data)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10830 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10831 DWPrint *print = (DWPrint *)data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10832 DWDialog *dwwait = (DWDialog *)print->printername;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10833 HWND printerlist, startspin, endspin;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10834 char *result = NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10835
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10836 window = (HWND)dwwait->data;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10837 printerlist = (HWND)dw_window_get_data(window, "_dw_list");
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10838 startspin = (HWND)dw_window_get_data(window, "_dw_start_spin");
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10839 endspin = (HWND)dw_window_get_data(window, "_dw_end_spin");
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10840 if(printerlist)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10841 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10842 char printername[32] = "";
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10843 int selected = dw_listbox_selected(printerlist);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10844
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10845 /* Get the name of the selected printer */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10846 if(selected != DW_ERROR_UNKNOWN)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10847 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10848 dw_listbox_get_text(printerlist, selected, printername, 32);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10849 if(printername[0])
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10850 print->printername = result = strdup(printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10851 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10852 /* Get the start and end positions */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10853 print->startpage = (unsigned int)dw_spinbutton_get_pos(startspin);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10854 print->endpage = (unsigned int)dw_spinbutton_get_pos(endspin);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10855
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10856 /* If the start is bigger than end... swap them */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10857 if(print->startpage > print->endpage)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10858 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10859 print->endpage = print->startpage;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10860 print->startpage = (unsigned int)dw_spinbutton_get_pos(endspin);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10861 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10862 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10863
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10864 dw_window_destroy(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10865 dw_dialog_dismiss(dwwait, (void *)result);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10866 return FALSE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10867 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10868
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10869 /* Borrowed functions which should probably be rewritten */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10870 BOOL _ExtractLogAddress(char * LogAddress, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10871 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10872 char *p;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10873
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10874 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10875 while(*p++ != ';'); /* Gets to first ';' and one char beyond */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10876 while(*p++ != ';'); /* Gets to second ';' and one char beyond */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10877 while(*p != ';') *LogAddress++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10878 *LogAddress = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10879 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10880 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10881
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10882 BOOL _ExtractDriverName(char * DriverName, char * DetailStr)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10883 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10884 char *p;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10885
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10886 p = DetailStr;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10887 while(*p++ != ';'); /* Gets to first ';' and one char beyond */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10888 while(*p != '.' && *p != ';' && *p != ',')
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10889 *DriverName++ = *p++;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10890 *DriverName = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10891 return TRUE;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10892 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10893
1310
47dbe605a03f Removed an unused variable in the new code on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1309
diff changeset
10894 /* EMX Doesn't seem to define this? */
47dbe605a03f Removed an unused variable in the new code on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1309
diff changeset
10895 #ifndef NERR_BufTooSmall
47dbe605a03f Removed an unused variable in the new code on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1309
diff changeset
10896 #define NERR_BufTooSmall 2123
47dbe605a03f Removed an unused variable in the new code on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1309
diff changeset
10897 #endif
47dbe605a03f Removed an unused variable in the new code on OS/2 and Windows.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1309
diff changeset
10898
585
4df2d1639005 Added stubs for the HTML render on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 579
diff changeset
10899 /*
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10900 * Creates a new print object.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10901 * Parameters:
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
10902 * jobname: Name of the print job to show in the queue.
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10903 * flags: Flags to initially configure the print object.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10904 * pages: Number of pages to print.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10905 * drawfunc: The pointer to the function to be used as the callback.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10906 * drawdata: User data to be passed to the handler function.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10907 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10908 * A handle to the print object or NULL on failure.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10909 */
1152
58b5374355ab Added print jobname parameter to dw_print_new().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1150
diff changeset
10910 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
10911 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10912 char printername[32], tmpbuf[20];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10913 HWND window, hbox, vbox, printerlist, button, text;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10914 DWDialog *dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10915 DWPrint *print;
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10916 PVOID pBuf = NULL;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10917 ULONG fsType = SPL_PR_QUEUE;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10918 ULONG cbBuf, cRes, cTotal, cbNeeded;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10919 SPLERR splerr = 0 ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10920 PPRINTERINFO pRes ; /* Check the default printer for now... want a printer list in the future */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10921 int cb = PrfQueryProfileString(HINI_PROFILE, (PSZ)"PM_SPOOLER", (PSZ)"PRINTER", (PSZ)"", printername, 32);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10922
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10923 if(!drawfunc || !(print = calloc(1, sizeof(DWPrint))))
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10924 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10925
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10926 print->drawfunc = drawfunc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10927 print->drawdata = drawdata;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10928 print->jobname = jobname ? jobname : "Dynamic Windows Print Job";
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10929 print->startpage = 1;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10930 print->endpage = pages;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10931 print->flags = flags;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10932
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10933 /* Check to see how much space we need for the printer list */
1233
365f92e85771 Fix for dw_font_text_extents_get() on OS/2 not honoring the font set with dw_pixmap_set_font().
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1226
diff changeset
10934 splerr = SplEnumPrinter(NULL, 0, fsType, NULL, 0, &cRes, &cTotal, &cbNeeded ,NULL);
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10935
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10936 if(splerr == ERROR_MORE_DATA || splerr == NERR_BufTooSmall)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10937 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10938 /* Allocate memory for the buffer using the count of bytes that were returned in cbNeeded. */
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10939 DosAllocMem(&pBuf, cbNeeded, PAG_READ|PAG_WRITE|PAG_COMMIT);
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10940
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10941 /* Set count of bytes in buffer to value used to allocate buffer. */
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10942 cbBuf = cbNeeded;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10943
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10944 /* Call function again with the correct buffer size. */
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10945 splerr = SplEnumPrinter(NULL, 0, fsType, pBuf, cbBuf, &cRes, &cTotal, &cbNeeded, NULL);
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10946 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10947
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10948 /* Make sure we got a valid result */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10949 if(cb > 2)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10950 printername[cb-2] = '\0';
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10951 else
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10952 printername[0] = '\0';
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10953
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10954 /* If we didnt' get a printer list or default printer abort */
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10955 if(!cRes && !printername[0])
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10956 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10957 /* Show an error and return failure */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10958 dw_messagebox("Printing", DW_MB_ERROR | DW_MB_OK, "No printers detected.");
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10959 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10960 return NULL;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10961 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10962
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10963 /* Create the print dialog */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10964 window = dw_window_new(HWND_DESKTOP, "Choose Printer", FCF_SHELLPOSITION | FCF_TITLEBAR | FCF_DLGBORDER | FCF_CLOSEBUTTON | FCF_SYSMENU);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10965
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10966 vbox = dw_box_new(DW_VERT, 5);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10967
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10968 dw_box_pack_start(window, vbox, 0, 0, TRUE, TRUE, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10969
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10970 printerlist = dw_listbox_new(0, FALSE);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10971 dw_box_pack_start(vbox, printerlist, 1, 1, TRUE, TRUE, 0);
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10972
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10973 /* If there are any returned structures in the buffer... */
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10974 if(pBuf && cRes)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10975 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10976 int count = 0;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10977
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10978 pRes = (PPRINTERINFO)pBuf ;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10979 while(cRes--)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10980 {
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10981 dw_listbox_append(printerlist, (char *)pRes[cRes].pszPrintDestinationName);
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10982 /* If this is the default printer... select it by default */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
10983 if(strcmp((char *)pRes[cRes].pszPrintDestinationName, printername) == 0)
1199
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10984 dw_listbox_select(printerlist, count, TRUE);
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10985 count++;
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10986 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10987 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10988 else
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10989 {
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10990 /* Otherwise just add the default */
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10991 dw_listbox_append(printerlist, printername);
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10992 dw_listbox_select(printerlist, 0, TRUE);
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10993 }
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10994
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10995 /* Free any unneeded memory */
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10996 if(pBuf)
af4ca6ccbdff Added support on OS/2 for querying the printer list...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1198
diff changeset
10997 DosFreeMem(pBuf);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10998
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
10999 dw_window_set_data(window, "_dw_list", (void *)printerlist);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11000
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11001 /* Start spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11002 hbox = dw_box_new(DW_HORZ, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11003
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11004 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11005
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11006 text = dw_text_new("Start page:", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11007 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11008 dw_box_pack_start(hbox, text, 70, 20, FALSE, FALSE, 3);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11009
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11010 button = dw_spinbutton_new("1", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11011 dw_spinbutton_set_limits(button, 1, pages);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11012 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11013 dw_window_set_data(window, "_dw_start_spin", (void *)button);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11014
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11015 /* End spinbutton */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11016 hbox = dw_box_new(DW_HORZ, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11017
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11018 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11019
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11020 text = dw_text_new("End page:", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11021 dw_window_set_style(text, DW_DT_VCENTER, DW_DT_VCENTER);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11022 dw_box_pack_start(hbox, text, 70, 20, FALSE, FALSE, 3);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11023
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11024 sprintf(tmpbuf, "%d", pages);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11025 button = dw_spinbutton_new(tmpbuf, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11026 dw_spinbutton_set_limits(button, 1, pages);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11027 dw_box_pack_start(hbox, button, 20, 20, TRUE, FALSE, 3);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11028 dw_window_set_data(window, "_dw_end_spin", (void *)button);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11029
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11030 /* Ok and Cancel buttons */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11031 hbox = dw_box_new(DW_HORZ, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11032
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11033 dw_box_pack_start(vbox, hbox, 0, 0, TRUE, FALSE, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11034 dw_box_pack_start(hbox, 0, 100, 1, TRUE, FALSE, 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11035
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11036 button = dw_button_new("Ok", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11037 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11038
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11039 dwwait = dw_dialog_new((void *)window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11040 /* Save it temporarily there until we need it */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11041 print->printername = (char *)dwwait;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11042
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11043 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_printer_ok_func), (void *)print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11044
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11045 button = dw_button_new("Cancel", 0);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11046 dw_box_pack_start(hbox, button, 50, 30, TRUE, FALSE, 3);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11047
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11048 dw_signal_connect(button, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_printer_cancel_func), (void *)print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11049 dw_signal_connect(window, DW_SIGNAL_DELETE, DW_SIGNAL_FUNC(_dw_printer_cancel_func), (void *)print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11050
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11051 dw_window_set_size(window, 300, 400);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11052
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11053 dw_window_show(window);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11054
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11055 print->printername = dw_dialog_wait(dwwait);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11056
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11057 /* The user picked a printer */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11058 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11059 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11060 char PrintDetails[256];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11061 char DriverName[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11062 char LogAddress[32];
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11063 DEVOPENSTRUC dop;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11064
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11065 /* Get the printer information string */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11066 cb = PrfQueryProfileString(HINI_PROFILE, (PSZ)"PM_SPOOLER_PRINTER", (PSZ)print->printername, (PSZ)"", PrintDetails, 256);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11067 _ExtractLogAddress(LogAddress, PrintDetails);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11068 _ExtractDriverName(DriverName, PrintDetails);
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11069 dop.pszDriverName = (PSZ)DriverName;
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11070 dop.pszLogAddress = (PSZ)LogAddress;
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11071 dop.pdriv = NULL;
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11072 dop.pszDataType = (PSZ)"PM_Q_STD";
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11073 /* Attempt to open a device context and return a handle to it */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11074 print->hdc = DevOpenDC(dwhab, OD_QUEUED, (PSZ)"*", 4L, (PDEVOPENDATA) &dop, (HDC)NULL);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11075 if(print->hdc)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11076 return print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11077 }
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11078 /* The user canceled */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11079 if(print->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11080 free(print->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11081 free(print);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11082 return NULL;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11083 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11084
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11085 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11086 * Runs the print job, causing the draw page callbacks to fire.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11087 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11088 * print: Handle to the print object returned by dw_print_new().
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11089 * flags: Flags to run the print job.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11090 * Returns:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11091 * DW_ERROR_UNKNOWN on error or DW_ERROR_NONE on success.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11092 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11093 int API dw_print_run(HPRINT print, unsigned long flags)
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11094 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11095 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11096 HPIXMAP pixmap;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11097 int x, result = DW_ERROR_UNKNOWN;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11098 SIZEL sizl = { 0, 0 };
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11099
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11100 if(!p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11101 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11102
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11103 if (!(pixmap = calloc(1,sizeof(struct _hpixmap))))
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11104 return result;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11105
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11106 /* Start the job */
1341
184b3aedc2ff Added PMPrintf support to dw_debug() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1339
diff changeset
11107 DevEscape(p->hdc, DEVESC_STARTDOC, strlen(p->jobname), (PBYTE)p->jobname, NULL, NULL);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11108
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
11109 pixmap->font = WinCreateWindow(HWND_OBJECT, WC_FRAME, NULL, 0,0,0,1,1, NULLHANDLE, HWND_TOP,0, NULL, NULL);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11110 pixmap->hdc = p->hdc;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11111 pixmap->hps = GpiCreatePS(dwhab, p->hdc, &sizl, PU_PELS | GPIF_DEFAULT | GPIT_NORMAL | GPIA_ASSOC);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11112 pixmap->transcolor = DW_RGB_TRANSPARENT;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11113 pixmap->width = sizl.cx;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11114 pixmap->height = sizl.cy;
1182
cef7400dcaba Switch to using a dummy window handle for pixmap fonts on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1181
diff changeset
11115 dw_pixmap_set_font(pixmap, DefaultFont);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11116
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11117 /* Cycle through each page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11118 for(x=p->startpage-1; x<p->endpage && p->drawfunc; x++)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11119 {
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11120 p->drawfunc(print, pixmap, x, p->drawdata);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11121 /* Next page */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11122 DevEscape(p->hdc, DEVESC_NEWFRAME, 0, NULL, NULL, NULL);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11123 }
1183
0f85796c6988 Fix calling convention of print callback on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1182
diff changeset
11124 /* Determine the completion code */
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11125 if(p->drawfunc)
1339
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11126 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11127 result = DW_ERROR_NONE;
1339
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11128 /* Signal that we are done */
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11129 DevEscape(p->hdc, DEVESC_ENDDOC, 0, NULL, NULL, NULL);
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11130 }
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11131 else
c6d6788e207f Similarly need to send DEVESC_ABORTDOC on when canceled on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1337
diff changeset
11132 DevEscape(p->hdc, DEVESC_ABORTDOC, 0, NULL, NULL, NULL);
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11133 /* Free memory */
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11134 dw_pixmap_destroy(pixmap);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11135 if(p->printername)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11136 free(p->printername);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11137 free(p);
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11138 return result;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11139 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11140
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11141 /*
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11142 * Cancels the print job, typically called from a draw page callback.
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11143 * Parameters:
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11144 * print: Handle to the print object returned by dw_print_new().
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11145 */
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11146 void API dw_print_cancel(HPRINT print)
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11147 {
1181
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11148 DWPrint *p = print;
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11149
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11150 if(p)
5d3c1b0686ce Initial attempt at printing on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1160
diff changeset
11151 p->drawfunc = NULL;
1137
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11152 }
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11153
e24e5a13ff2c Added code to test the new print functions in dwtest.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1085
diff changeset
11154 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11155 * Returns a pointer to a static buffer which containes the
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11156 * current user directory. Or the root directory (C:\ on
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11157 * OS/2 and Windows).
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11158 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11159 char * API dw_user_dir(void)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11160 {
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11161 static char _user_dir[MAX_PATH+1] = {0};
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11162
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11163 if(!_user_dir[0])
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11164 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11165 char *home = getenv("HOME");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11166
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11167 if(home)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11168 strcpy(_user_dir, home);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11169 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11170 strcpy(_user_dir, "C:\\");
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11171 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11172 return _user_dir;
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11173 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11174
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11175 /*
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11176 * Returns a pointer to a static buffer which containes the
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11177 * private application data directory.
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11178 */
1384
156e32814c83 Cleanup of the previous commits and added Unix support.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1382
diff changeset
11179 char * API dw_app_dir(void)
1381
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11180 {
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11181 return _dw_exec_dir;
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11182 }
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11183
3ba4853d5b78 Initial attempt at dw_app_dir() for OS/2, Windows and Mac...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1377
diff changeset
11184 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11185 * Call a function from the window (widget)'s context.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11186 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11187 * handle: Window handle of the widget.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11188 * function: Function pointer to be called.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11189 * data: Pointer to the data to be passed to the function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11190 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11191 void API dw_window_function(HWND handle, void *function, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11192 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11193 WinSendMsg(handle, WM_USER, (MPARAM)function, (MPARAM)data);
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11194 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11195
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11196 /* 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
11197 * 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
11198 * 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
11199 */
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
11200 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
11201 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11202 UserData *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11203
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11204 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11205 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11206 if(stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11207 return tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11208 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11209 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11210 return NULL;
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11211 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11212
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
11213 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
11214 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11215 UserData *new = _find_userdata(root, varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11216
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11217 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11218 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11219 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11220 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11221 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11222 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11223 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11224 new = malloc(sizeof(UserData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11225 if(new)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11226 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11227 new->varname = strdup(varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11228 new->data = data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11229
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11230 new->next = NULL;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11231
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11232 if (!*root)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11233 *root = new;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11234 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11235 {
1304
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
11236 UserData *prev = *root, *tmp = prev->next;
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
11237
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11238 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11239 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11240 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11241 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11242 }
1304
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
11243 prev->next = new;
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11244 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11245 return TRUE;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11246 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11247 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11248 return 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
11249 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11250
159
9c0f1f04f4c7 Replacement window disable code... looks much nicer.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 157
diff changeset
11251 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
11252 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11253 UserData *prev = NULL, *tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11254
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11255 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11256 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11257 if(all || stricmp(tmp->varname, varname) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11258 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11259 if(!prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11260 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11261 *root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11262 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11263 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11264 if(!all)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11265 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11266 tmp = *root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11267 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11268 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11269 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11270 /* If all is true we should
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11271 * never get here.
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11272 */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11273 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11274 free(tmp->varname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11275 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11276 return 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11277 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11278 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11279 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11280 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11281 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11282 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11283 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11284 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11285 return 0;
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11286 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11287
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11288 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11289 * 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
11290 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11291 * 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
11292 * 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
11293 * 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
11294 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11295 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
11296 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11297 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11298
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11299 if(!blah)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11300 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11301 if(!dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11302 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11303
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11304 blah = calloc(1, sizeof(WindowData));
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11305 WinSetWindowPtr(window, QWP_USER, blah);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11306 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11307
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11308 if(data)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11309 _new_userdata(&(blah->root), dataname, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11310 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11311 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11312 if(dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11313 _remove_userdata(&(blah->root), dataname, FALSE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11314 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11315 _remove_userdata(&(blah->root), NULL, TRUE);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11316 }
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11317 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11318
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11319 /*
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11320 * 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
11321 * Parameters:
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11322 * 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
11323 * 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
11324 * 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
11325 */
507
c607eb385e58 Added missing calling conventions. Thanks Bastian for pointing this out.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 503
diff changeset
11326 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
11327 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11328 WindowData *blah = (WindowData *)WinQueryWindowPtr(window, QWP_USER);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11329
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11330 if(blah && blah->root && dataname)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11331 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11332 UserData *ud = _find_userdata(&(blah->root), dataname);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11333 if(ud)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11334 return ud->data;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11335 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11336 return NULL;
90
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11337 }
eeb98f881663 Committed the dw_window_set/get_data() changes from the FX tree.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 72
diff changeset
11338
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11339 /*
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11340 * 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
11341 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11342 * 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
11343 * 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
11344 * 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
11345 * Returns:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11346 * 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
11347 */
199
b955228477b3 Removed the window parameter to dw_timer_connect() it was no needed.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 195
diff changeset
11348 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
11349 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11350 if(sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11351 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11352 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11353
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11354 if(timerid)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11355 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11356 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11357 return timerid;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11358 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11359 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11360 return 0;
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11361 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11362
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11363 /*
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11364 * Removes timer callback.
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11365 * Parameters:
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11366 * 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
11367 */
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11368 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
11369 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11370 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11371
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11372 /* 0 is an invalid timer ID */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11373 if(!id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11374 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11375
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11376 WinStopTimer(dwhab, NULLHANDLE, id);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11377
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11378 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11379 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11380 if(tmp->id == id)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11381 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11382 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11383 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11384 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11385 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11386 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11387 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11388 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11389 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11390 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11391 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11392 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11393 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11394 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11395 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11396 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11397 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11398 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11399 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11400 }
195
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11401 }
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11402
b023d363fc09 Added scrollbar and timer support on OS/2 and GTK.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 192
diff changeset
11403 /*
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11404 * Add a callback to a window event.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11405 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11406 * window: Window handle of signal to be called back.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11407 * signame: A string pointer identifying which signal to be hooked.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11408 * sigfunc: The pointer to the function to be used as the callback.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11409 * data: User data to be passed to the handler function.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11410 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11411 void API dw_signal_connect(HWND window, char *signame, void *sigfunc, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11412 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11413 ULONG message = 0, id = 0;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11414
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11415 if(window && signame && sigfunc)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11416 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11417 if((message = _findsigmessage(signame)) != 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11418 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11419 /* Handle special case of the menu item */
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11420 if(message == WM_COMMAND && window < 65536)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11421 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11422 char buffer[15];
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11423 HWND owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11424
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11425 sprintf(buffer, "_dw_id%d", (int)window);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11426 owner = (HWND)dw_window_get_data(hwndApp, buffer);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11427
1304
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
11428 /* Make sure there are no dupes from popups */
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
11429 dw_signal_disconnect_by_window(window);
68f18dccfb8f Experimental change to menu code on OS/2 to allow dw_window_enable/disable to work on menu item handles.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1299
diff changeset
11430
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11431 if(owner)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11432 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11433 id = window;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11434 window = owner;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11435 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11436 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11437 _new_signal(message, window, id, sigfunc, data);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11438 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11439 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11440 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11441
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11442 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11443 * Removes callbacks for a given window with given name.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11444 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11445 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11446 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11447 void API dw_signal_disconnect_by_name(HWND window, char *signame)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11448 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11449 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11450 ULONG message;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11451
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11452 if(!window || !signame || (message = _findsigmessage(signame)) == 0)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11453 return;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11454
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11455 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11456 {
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
11457 if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->message == message)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11458 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11459 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11460 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11461 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11462 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11463 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11464 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11465 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11466 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11467 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11468 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11469 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11470 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11471 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11472 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11473 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11474 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11475 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11476 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11477 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11478 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11479
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11480 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11481 * Removes all callbacks for a given window.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11482 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11483 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11484 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11485 void API dw_signal_disconnect_by_window(HWND window)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11486 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11487 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11488
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11489 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11490 {
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
11491 if((window < 65536 && tmp->id == window) || tmp->window == window)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11492 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11493 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11494 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11495 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11496 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11497 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11498 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11499 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11500 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11501 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11502 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11503 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11504 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11505 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11506 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11507 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11508 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11509 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11510 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11511 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11512 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11513
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11514 /*
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11515 * Removes all callbacks for a given window with specified data.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11516 * Parameters:
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11517 * window: Window handle of callback to be removed.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11518 * data: Pointer to the data to be compared against.
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11519 */
174
75bf3051235f Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 172
diff changeset
11520 void API dw_signal_disconnect_by_data(HWND window, void *data)
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11521 {
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11522 SignalHandler *prev = NULL, *tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11523
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11524 while(tmp)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11525 {
1309
e73c41653de8 Added support on OS/2 and Windows for looking for signal handlers with menu IDs...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1306
diff changeset
11526 if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->data == data)
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11527 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11528 if(prev)
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11529 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11530 prev->next = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11531 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11532 tmp = prev->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11533 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11534 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11535 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11536 Root = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11537 free(tmp);
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11538 tmp = Root;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11539 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11540 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11541 else
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11542 {
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11543 prev = tmp;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11544 tmp = tmp->next;
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11545 }
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11546 }
3
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11547 }
ktk@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff changeset
11548
1354
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11549 /*
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11550 * Create a new calendar window (widget) to be packed.
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11551 * Parameters:
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11552 * id: An ID to be used with dw_window_from_id() or 0L.
1354
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11553 * Returns:
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11554 * Handle to the created calendar or NULL on error.
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11555 */
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11556 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
11557 {
823
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11558 WindowData *blah = calloc(sizeof(WindowData), 1);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11559 DATETIME dt;
823
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11560 HWND tmp = WinCreateWindow(HWND_OBJECT,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11561 WC_STATIC,
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11562 NULL,
643
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11563 WS_VISIBLE | SS_TEXT,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11564 0,0,2000,1000,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11565 NULLHANDLE,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11566 HWND_TOP,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11567 id,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11568 NULL,
9ab89d89e6b4 Add dw_listview_insert()
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 637
diff changeset
11569 NULL);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11570 blah->oldproc = WinSubclassWindow(tmp, _calendarproc);
823
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11571 WinSetWindowPtr(tmp, QWP_USER, blah);
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11572 dw_window_set_font(tmp, DefaultFont);
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11573 if(!DosGetDateTime(&dt))
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11574 dw_calendar_set_date(tmp, dt.year, dt.month, dt.day);
823
fd775ade945f Implemented dw_clipboard_get_text() and dw_clipboard_set_text() on OS/2.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 822
diff changeset
11575 return tmp;
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11576 }
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11577
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11578 /*
1354
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11579 * Sets the current date of a calendar.
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11580 * Parameters:
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11581 * handle: The handle to the calendar returned by dw_calendar_new().
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11582 * year, month, day: To set the calendar to display.
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11583 */
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11584 void API dw_calendar_set_date( HWND window, unsigned int year, unsigned int month, unsigned int day )
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11585 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11586 /* Need to be 0 based */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11587 if(year > 0)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11588 year--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11589 if(month > 0)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11590 month--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11591 if(day > 0)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11592 day--;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11593
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11594 dw_window_set_data(window, "_dw_year", DW_INT_TO_POINTER(year));
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11595 dw_window_set_data(window, "_dw_month", DW_INT_TO_POINTER(month));
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11596 dw_window_set_data(window, "_dw_day", DW_INT_TO_POINTER(day));
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11597 /* Make it redraw */
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11598 WinPostMsg(window, WM_PAINT, 0, 0);
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11599 }
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11600
1354
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11601 /*
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11602 * Gets the year, month and day set in the calendar widget.
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11603 * Parameters:
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11604 * handle: The handle to the calendar returned by dw_calendar_new().
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11605 * year: Variable to store the year or NULL.
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11606 * month: Variable to store the month or NULL.
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11607 * day: Variable to store the day or NULL.
1f22addc2722 Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1349
diff changeset
11608 */
637
9fa3cb5b3290 Bring OS/2 functionality up to latest
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 636
diff changeset
11609 void API dw_calendar_get_date( HWND window, unsigned int *year, unsigned int *month, unsigned int *day )
594
af25ea2dc5b3 Add dummy calendar widget. Need to simulate one.4?\002?\007
mhessling@81767d24-ef19-dc11-ae90-00e081727c95
parents: 585
diff changeset
11610 {
1344
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11611 if(year)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11612 *year = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_year")) + 1;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11613 if(month)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11614 *month = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_month")) + 1;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11615 if(day)
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11616 *day = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_day")) + 1;
af989b9f1767 Initial try at a custom calendar widget for OS/2.... not finished...
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents: 1342
diff changeset
11617 }